CodeBlock
data-displayCode display block with line numbers, language header, copy-to-clipboard button, monospace font, and horizontal scroll. Token-driven for all visual elements.
Import
typescript
import { CodeBlock } from "packages/ui/src";Props
CodeBlockProps
| Prop | Type | Required |
|---|---|---|
code | string | Yes |
language | string | No |
showLineNumbers | boolean | No |
showCopy | boolean | No |
Examples
Code Block
Code display with line numbers, language header, and copy button.
TypeScript
typescript
import { Button, Card } from "@cms-aichemist/ui";export function Dashboard() { return ( <Card style={{ padding: "2rem" }}> <h1>Welcome</h1> <Button onClick={() => console.log("clicked")}> Get Started </Button> </Card> );}JSON (no line numbers)
json
{ "$schema": "https://design-tokens.org/schema.json", "color": { "primary": { "base": { "$value": "#a78bfa", "$type": "color" }, "hover": { "$value": "#8b5cf6", "$type": "color" } } }}Bash
bash
# Build and deploynpm run buildpm2 restart cms-webcurl -s https://cms.chem.dev/ | head -1