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

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

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

<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

PropTypeDefaultNotes
codestringSlot textSource to highlight.
langstring"text"Language passed to Shiki.
titlestringundefinedOptional header label. Fences accept title="...".
copybooleantrueShow the Basecoat copy action.
classstring""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

npm install reallysimpledocs

With title and actions

Terminal
npm run build

Multiple examples

Compose ordinary tabs with code blocks:

npm install reallysimpledocs