Code Block
Source snippet with header, line numbers and copy.
Import
tsx
import { CodeBlock } from "@cooud-ui/ui";
bash
npx cooud-ui add code-block
Examples
API Reference
Generated from the component's exported types.
CodeBlockProps
Extends Omit<HTMLAttributes<HTMLDivElement>, "children">
| Prop | Type | Default | Description |
|---|---|---|---|
code* | string | — | Raw source to render and copy. |
language | string | — | Language label rendered as a Badge in the header. |
filename | string | — | File name rendered in the header. |
showLineNumbers | boolean | false | Render a gutter with 1-based line numbers. Defaults to false. |