This type defines the configuration for a component to be exposed to the chat.
API
interface ExposedComponent<T extends ComponentType<any>> {children?: 'any' | 'text' | ExposedComponent<any>[] | false;component: T;description: string;fallback?: ComponentType<ComponentFallbackProps>;name: string;props?: ComponentPropSchema<T>;}ExposedComponent
@typeTComponentType<any>children
'any' | 'text' | ExposedComponent<any>[] | falseThe children of the component.
component
TThe component to be exposed.
description
stringThe 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
stringThe name of the component.
props
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'),
},
});