Composable code / terminal panel with header, line numbers, diffs, and copy. Pass language for Shiki Dark+ highlighting (always on a dark surface). Content stays dir="ltr". For the AI agent chrome, see Code Block.
Streaming
Tokens arrive live with a Writing status — Replay remounts the stream.
Loading…
Installation
CLI
Also needs
npx @sonojs/ui@latest add button use-highlighted-code && npm i lucide-react shikiUsage
code-block.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "default" · "destructive" | "default" | Tone of the block surface. |
| size | "default" · "sm" | "default" | Density. Small suits tool / trace output. |
| language | string | — | On CodeBlockContent — Shiki id (`tsx`, `json`, `bash`, …). |
| wrap | boolean | false | On CodeBlockContent — wrap long lines. |
| lineNumbers | boolean | false | On CodeBlockContent — show a line number gutter. |
| startLine | number | 1 | On CodeBlockContent — first line number in the gutter. |