hashbrown

ExposedComponent

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

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. The model reads it to decide when to use the component, so say when to use it, when not to, and how it differs from similar components. Put value conventions in the prop schemas' descriptions instead.

fallback
ComponentType<ComponentFallbackProps>

Optional fallback component rendered while props are streaming.

name
string

The name of the component.

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'),
  },
});