# Code

Use fenced code blocks or `Code` for syntax-highlighted examples. Both render the standard Basecoat Code Block, with an optional title and copy action.

## Usage

````md
```bash title="Terminal"
npm install reallysimpledocs
```
````

In MDX, use `Code` when the source comes from a string or the header needs custom actions:

```mdx
<Code title="Terminal" lang="bash" code="npm run build">
  <a slot="actions" href="/quickstart/" class="btn" data-variant="ghost" data-size="xs">Quickstart</a>
</Code>
```

## Options

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `code` | `string` | Slot text | Source to highlight. |
| `lang` | `string` | `"text"` | Language passed to Shiki. |
| `title` | `string` | `undefined` | Optional header label. Fences accept `title="..."`. |
| `copy` | `boolean` | `true` | Show the Basecoat copy action. |
| `class` | `string` | `""` | Extra classes on the code block. |

The `actions` slot accepts buttons or links. With a title, actions appear in the header. Otherwise, they float above the code. Custom actions supply their own behavior.

## Examples

### Default

```md

```

### With title and actions

```mdx
<Code title="Terminal" lang="bash" code="npm run build">
  <a slot="actions" href="/quickstart/" class="btn" data-variant="ghost" data-size="xs">Quickstart</a>
</Code>
```

### Multiple examples

Compose ordinary tabs with code blocks:

```mdx

```
