CodeBlock
atomStyled code display with optional tabs, a language label, copy-to-clipboard, and an AI prompt variant. Zero-dependency — no syntax highlighting library bundled.
Single snippet
A code block with a language label.
Tabbed install commands
Multiple related snippets with tab switching.
AI prompt variant
Single-line truncated display for AI tool prompts.
Usage
Installation
API Reference
CodeBlock props — * required
| Prop | Type | Default | Description |
|---|---|---|---|
code | string | "<Button variant='primary'>Save</Button>" | Code string — used in single (non-tabbed) mode. |
language | string | "tsx" | Language label shown in the header. Purely cosmetic. |
tabs | { label: string; code: string; language?: string; icon?: string }[] | — | Tabbed mode. Each entry has label, code, optional language and icon. Switching tabs resets copy state. |
variant | "code" | "prompt" | "code" | "code" renders a scrollable pre/code block. "prompt" renders a single-line truncated span suited to AI tool prompts. |
helperText | string | — | Descriptive text rendered between the tab bar and the code area. |
showCopyButton | boolean | true | Renders a copy-to-clipboard button. Shows a 'Copied!' confirmation for 2s on success. |