hashbrown

ExposedComponent

This type defines the configuration for a component to be exposed to the chat.

API

ExposedComponent
@typeT
ComponentType<any>
children
'any' | 'text' | ExposedComponent<any>[] | false

The children of the component.

component
T

The component to be exposed.

description
string

The description of the component. This is also used by the LLM to understand when to use the component.

fallback
ComponentType<ComponentFallbackProps>

Optional fallback component rendered while props are streaming.

name
string

The name of the component.

props
ComponentPropSchema<T>

The schema describing the props for this component.

Examples

exposeComponent(CardComponent, {
  name: 'CardComponent',
  description: 'Show a card with children components to the user',
  children: 'any',
  props: {
    title: s.string('The title of the card'),
    description: s.streaming.string('The description of the card'),
  },
});