"use client";
import { CodeCard } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
code | string | — | Code (code wins; strings copy exactly). |
filename | ReactNode | — | File name shown in the header (monospace). |
language | string | — | Language label (e.g. tsx, bash); also data-language on <code>. |
maxHeight | number | string | — | Collapsed height ("20rem", 320). |
variant | "code" | "terminal" | code | code (default) or terminal: command output, ASCII charts and box-drawing art — tight line height (--pixxl-line-height-tight) so │/─ glyphs join into unbroken lines, and no ligatures. |
actions | ReactNode | — | Extra header actions (before the copy button). |
children | ReactNode | — | The code (a string keeps copy exact); code wins over children. |
collapsible | boolean | true | Collapse to maxHeight with a "Show more" toggle when the code is taller (default true when maxHeight is set). |
copyable | boolean | true | Show the copy button (default true). |
defaultExpanded | boolean | — | Start expanded (collapsible cards). |
codestring
Code (code wins; strings copy exactly).
filenameReactNode
File name shown in the header (monospace).
languagestring
Language label (e.g. tsx, bash); also data-language on <code>.
maxHeightnumber | string
Collapsed height ("20rem", 320).
variantdefault code"code" | "terminal"
code (default) or terminal: command output, ASCII charts and box-drawing art — tight line height (--pixxl-line-height-tight) so │/─ glyphs join into unbroken lines, and no ligatures.
actionsReactNode
Extra header actions (before the copy button).
childrenReactNode
The code (a string keeps copy exact); code wins over children.
collapsibledefault trueboolean
Collapse to maxHeight with a "Show more" toggle when the code is taller (default true when maxHeight is set).
copyabledefault trueboolean
Show the copy button (default true).
defaultExpandedboolean
Start expanded (collapsible cards).
Other props are passed to the root element (HTMLAttributes<HTMLElement>), including className, style, id and aria-* attributes.
pnpm add @pixxl-tools/components
# then import the styles once
# import "@pixxl-tools/components/styles.css";Complex object props use fixed fixtures. Primitive props stay editable.
<CodeCard filename="install.sh" language="sh" code={code} wrapToggle />pnpm add @pixxl-tools/componentsconsole.log("line 1");
console.log("line 2");
console.log("line 3");
console.log("line 4");
console.log("line 5");
console.log("line 6");
console.log("line 7");
console.log("line 8");
console.log("line 9");
console.log("line 10");
console.log("line 11");
console.log("line 12");
console.log("line 13");
console.log("line 14");
console.log("line 15");
console.log("line 16");
console.log("line 17");
console.log("line 18");
console.log("line 19");
console.log("line 20");
console.log("line 21");
console.log("line 22");
console.log("line 23");
console.log("line 24");┌────────────┐
│ ▇▇▇▇▇▇ 12 │
│ ▇▇▇ 6 │
└────────────┘const code = "pnpm add @pixxl-tools/components";
const chart = "▁▂▃▅▇";
<CodeCard filename="install.sh" language="bash" maxHeight={320}>{code}</CodeCard>
<CodeCard code={chart} variant="terminal" />pnpm add @pixxl-tools/components
# then import the styles once
# import "@pixxl-tools/components/styles.css";const code = "pnpm add @pixxl-tools/components";
const chart = "▁▂▃▅▇";
<CodeCard filename="install.sh" language="sh" code={code} wrapToggle />