Skip to main content

IChatRendering interface

📖 Description​

Interface that specifies the block renderer interface. Used when creating custom blocks.

📃 Type declaration​

interface IChatRendering {
  required?: boolean;ReadonlyOptional
  question?: (props: IChatRenderProps) => ReactNode;FunctionOptional
  answer?: (props: IChatRenderProps) => ReactNode;FunctionOptional
  input?: (props: IChatRenderProps, done?: () => void, cancel?: () => void) => ReactNode;FunctionOptional
}
🖱ī¸ Hover with the mouse over a property name for a tooltip with the description of that property. Click it for more information.

🗃ī¸ Properties​


🏷ī¸ required​

Specifies if the block is required.

Type​

boolean


â–ļī¸ Functions​


🔧 answer​

Specifies a function that is invoked when the answer bubble for the block is generated. This function should return a valid React component.

Signature​

(props: IChatRenderProps) => ReactNode

Parameters​

NameTypeOptionalDescription
propsIChatRenderPropsNoContains the rendering props.

Return value​

Returns the ReactNode for the answer bubble.

tip

Read the Custom blocks guide for an example.


🔧 input​

Specifies a function that is invoked when the input area for the block is generated. This function should return a valid React component.

Signature​

(props: IChatRenderProps, done?: () => void, cancel?: () => void) => ReactNode

Parameters​

NameTypeOptionalDescription
propsIChatRenderPropsNoContains the rendering props.
done() => voidYesInvoke this function when the block is done and the runner can move to the next block.
cancel() => voidYesInvoke this function when the block wants to cancel and go back to the previous block.

Return value​

Returns the ReactNode for the input area.

tip

Read the Custom blocks guide for an example.


🔧 question​

Specifies a function that is invoked when the question bubble for the block is generated. This function should return a valid React component.

Signature​

(props: IChatRenderProps) => ReactNode

Parameters​

NameTypeOptionalDescription
propsIChatRenderPropsNoContains the rendering props.

Return value​

Returns the ReactNode for the question bubble.

tip

Read the Custom blocks guide for an example.