# Code block

A snippet with a copy button.

Import from `@a31labs/rax/code-block`.

## Usage

```tsx
<CodeBlock title="config.json" language="json" code={json} />
```

## Rules

Props: `code`, `title` (header bar, e.g. a filename or "JSON"), `language` (sets `data-language` only, no highlighting), `wrap` (pre-wrap). A `<pre><code>` in the mono font on surface-2 with a `line` border and radius 10px. It scrolls horizontally and is focusable so keyboard users can scroll it. Copy sits in the head, or top-right without a title, and shows "Copied" for 2s; when the clipboard is blocked it selects the code. The Copy click does not propagate, so it works inside clickable rows.

Page: https://rax.a31.at/components/code-block
