Data display
CodeBlock
Multi-line code with a copy button. Use for API payloads, configuration and logs.
When to use
Multi-line code, payloads, configuration or logs with a copy button.
Use something else
One value in a sentence → CodeInline.
Do
- Set
titleorlanguage; turn onlineNumbersfor longer snippets.
Don't
- Don't wrap long lines; let them scroll.
Props
| Prop | Type |
|---|---|
code required | string |
title | string |
language | string |
lineNumbers | boolean |
Use
const { CodeBlock } = window.Tessera;
const el = React.createElement(CodeBlock, { /* props */ });