Skip to content

AIDK API Reference / aidk-react / TextBlock

Function: TextBlock() ​

ts
function TextBlock(__namedParameters: Props): Element;

Defined in: packages/react/src/blocks/TextBlock.tsx:73

TextBlock component - displays text content from AI responses.

By default, renders plain text. For markdown rendering, provide a renderText function or children. This decoupled approach gives you control over:

  • Which markdown library to use (react-markdown, marked, etc.)
  • Sanitization (DOMPurify, etc.)
  • Custom styling and components

Parameters ​

ParameterType
__namedParametersProps

Returns ​

Element

Examples ​

tsx
<TextBlock block={block} />
tsx
<TextBlock
  block={block}
  renderText={(text) => <ReactMarkdown>{text}</ReactMarkdown>}
/>
tsx
<TextBlock block={block}>
  <MyCustomMarkdown text={block.text} />
</TextBlock>

Released under the MIT License.