# Prose, Code and Pre

Reading styles. `Prose` styles plain HTML you don’t control element by element, such as rendered Markdown. `Code` marks inline code, and `Pre` holds a block that scrolls on its own instead of widening the page.

```tsx
import { Code, Pre, Prose } from '@blocks/design-system'
```

## Prose

Wrap rendered HTML in `Prose`: paragraphs, headings, images and code inside it get spacing and type from the tokens. Every rule is scoped to the Prose element, so nothing outside it changes. Prose is a Box and renders a `<div>` unless you pass `as`.

**Example: Release candidate notes** (`examples/prose/install-notes.tsx`)

```tsx
import { Code, Pre, Prose } from '@blocks/design-system'

export default function InstallNotes() {
  return (
    <Prose as="article" aria-labelledby="install-notes-title">
      <h3 id="install-notes-title">Checking a release candidate</h3>
      <p>
        Install the tarball in a clean app, then compare its digest with the one in the release notes. The command
        below prints the SHA-256 of <Code>blocks-design-system-0.1.0-rc.0.tgz</Code>.
      </p>
      <Pre tabIndex={0} aria-label="Command to verify the tarball">
        <code>
          shasum -a 256 ./blocks-design-system-0.1.0-rc.0.tgz | tee release-digest.txt && grep -q
          &quot;$(cat expected-digest.txt)&quot; release-digest.txt && echo &quot;digest matches&quot;
        </code>
      </Pre>
      <p>If the digests differ, rebuild from the tagged revision before installing.</p>
      <a href="#installing-fonts">Next: installing fonts</a>
    </Prose>
  )
}
```

## Code

`Code` is monospace text at the code size. It renders `<code>` and takes Text’s props, such as `color`.

**Example: Inline code** (`examples/prose/inline-code.tsx`)

```tsx
import { Body, Code } from '@blocks/design-system'

export default function InlineCode() {
  return (
    <Body>
      Set <Code>data-ds-theme</Code> to <Code>"dark"</Code> on any element, or import{' '}
      <Code color="accent-text">@blocks/design-system/reset.css</Code> for global defaults.
    </Body>
  )
}
```

## Pre

`Pre` renders a `<pre>` on the surface background. Long lines scroll inside the block. Give a long block `tabIndex={0}` and an `aria-label` so keyboard users can reach it and scroll it with the arrow keys.

**Example: A long response** (`examples/prose/standalone-pre.tsx`)

```tsx
import { Pre } from '@blocks/design-system'

export default function StandalonePre() {
  return (
    <Pre tabIndex={0} aria-label="Station response">
      <code>
        {`{"station":"651:OR:SNTL","name":"Mount Hood Test Site","elevation_ft":5370,"snow_depth_in":84,"swe_in":31.2,"observed_at":"2026-12-01T06:00:00-08:00"}`}
      </code>
    </Pre>
  )
}
```

## Props

**`Prose` props**

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `as` | `ElementType` | — | The element or component to render, e.g. `as={NextLink}`. |

Also accepts [Box layout props](https://design-system.blocks-ui.com/components/box.md#props), [styling escape hatches](https://design-system.blocks-ui.com/components/box.md#escape-hatches), [margin props](https://design-system.blocks-ui.com/components/box.md#spacing) and [padding props](https://design-system.blocks-ui.com/components/box.md#spacing), and the native attributes of the element it renders.

**`Code` props**

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `as` | `ElementType` | `code` | `"code"`, `"pre"` or `"span"`. Defaults to `"code"`. |
| `color` | `"text" \| "overlay" \| "bg" \| "bg-subtle" \| "surface" \| "surface-hover" \| "surface-active" \| "selected" \| "border-subtle" \| "border" \| "border-strong" \| "focus-ring" \| "accent" \| "accent-hover" \| "accent-fg" \| "accent-subtle" \| "accent-text" \| "danger" \| "danger-hover" \| "danger-fg" \| "danger-subtle" \| "danger-text" \| "warning" \| "warning-hover" \| "warning-fg" \| "warning-subtle" \| "warning-text" \| "success" \| "success-hover" \| "success-fg" \| "success-subtle" \| "success-text" \| "info" \| "info-hover" \| "info-fg" \| "info-subtle" \| "info-text" \| "text-muted"` | — | A color token. Defaults to `"text"`. |
| `fontFamily` | `"body" \| "heading" \| "monospace"` | — | A font token: `body`, `heading` or `monospace`. |
| `fontSize` | `"body" \| "code" \| "heading" \| "xxs" \| "xs" \| "sm" \| "md" \| "lg" \| "xl" \| "xxl" \| "xxxl" \| "xxxxl" \| "xxxxxl" \| "inherit"` | — | A font size token, e.g. `"sm"` or `"heading"`, or `"inherit"` to keep the parent's size. Defaults to `"body"`. |
| `fontWeight` | `"body" \| "heading" \| "medium" \| "bold" \| "semibold"` | — | A font weight token: `body`, `medium`, `semibold`, `heading` or `bold`. |
| `lineHeight` | `"body" \| "heading" \| "inherit"` | — | `body` or `heading`, or `"inherit"` to keep the parent's. Defaults to `"body"`. |

Also accepts [styling escape hatches](https://design-system.blocks-ui.com/components/box.md#escape-hatches), [margin props](https://design-system.blocks-ui.com/components/box.md#spacing) and [a ref](https://design-system.blocks-ui.com/components/box.md#refs), and the native attributes of the element it renders.

**`Pre` props**

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `as` | `ElementType` | — | The element or component to render, e.g. `as={NextLink}`. |

Also accepts [Box layout props](https://design-system.blocks-ui.com/components/box.md#props), [styling escape hatches](https://design-system.blocks-ui.com/components/box.md#escape-hatches), [margin props](https://design-system.blocks-ui.com/components/box.md#spacing) and [padding props](https://design-system.blocks-ui.com/components/box.md#spacing), and the native attributes of the element it renders.

## Accessibility

- Prose doesn’t add landmarks. Give the article or section its own name when it is one.
- A scrolling block without a keyboard stop can only be scrolled with a pointer; add `tabIndex={0}` and a label.
- Screen readers read code character by character on request, so keep commands copyable rather than splitting them across elements.
