# Code block

https://docs.kleaver.ie/modules/code/

Code or config on a page: an embed snippet in a guide, a setting to copy. pre.code on its own is the plain block; wrap it in figure.code-block to add a filename label, and add data-copy for a Copy button (added by script, so without JavaScript there's no button and the text can still be selected). Long lines scroll sideways rather than wrap. A theme can tune it with --code-bg, --code-text, --code-border and --code-radius. Every example on these docs pages uses it.

HTML

```
<figure class="code-block" data-copy>
  <figcaption class="code-block__label">theme.css</figcaption>
  <pre class="code"><code>:root { --code-bg: #0e0f12; }</code></pre>
</figure>

<!-- or, with no label and no button -->
<pre class="code"><code>…</code></pre>
```

## Catalog

| Code | `pre.code > code`; optional `figure.code-block[data-copy]` > `figcaption.code-block__label` + `pre.code` (`ui.js` adds `button.code-block__copy`) · see **`modules.html#code`** | Code or config shown on a page. Scrolls sideways, monospace, never a brand colour. Knobs (optional, with fallbacks): `--code-bg`, `--code-text`, `--code-border`, `--code-radius`. No syntax colouring. |
