# Prose

Semantic-token typography for articles, rendered Markdown, CMS content, and rich text.

Prose gives bare document elements a consistent reading measure, type hierarchy, spacing rhythm, and semantic color treatment. Wrap rendered Markdown, trusted CMS output, or plain JSX without adding classes to every heading, list, quote, code block, or table.

```tsx
import { Prose } from "@zentara-co/zenos-ui";

function ProseExample() {
  return (
    <Prose as="article" className="mx-auto">
      <h2>Constraints make systems easier to extend</h2>
      <p>
        Zenos components use semantic tokens so a theme can change without rewriting every
        component. Read the <a href="/foundations/tokens/">theme customization guide</a> for the
        complete token map.
      </p>
      <ul>
        <li>Components consume semantic roles instead of literal colors.</li>
        <li>Spacing and typography follow a shared scale.</li>
        <li>Application-specific behavior stays outside generic UI.</li>
      </ul>
      <blockquote>
        A shared component should be easier to use correctly than rebuilding it locally.
      </blockquote>
      <p>
        Import the wrapper with <code>import {`{ Prose }`} from "@zentara-co/zenos-ui"</code>.
      </p>
    </Prose>
  );
}
```

## Import

```tsx
import { Prose } from "@zentara-co/zenos-ui";
```

## Usage

Use `as` when the wrapper has document meaning. Zenos layout polymorphism uses `as`, so an article or section keeps its native props and ref type.

```tsx
<Prose as="article" size="lg">
  <h1>Release notes</h1>
  <p>Version 2.4 improves form density and keyboard behavior.</p>
</Prose>
```

## Sizes

The size changes body type, heading hierarchy, and block spacing as one reading system. The defaults follow a 14/24 body with a 16px block step at `sm`, 16/28 with a 20px step at `md`, and 17/28 with a 24px step at `lg`. Use `sm` for compact product descriptions and stored editor output, `md` for documentation and release notes, and `lg` for long-form articles.

```tsx
import { Prose, Stack } from "@zentara-co/zenos-ui";

function ProseSizesExample() {
  return (
    <Stack gap="6" className="w-full max-w-3xl">
      {(["sm", "md", "lg"] as const).map((size) => (
        <Prose key={size} size={size}>
          <h3>{size.toUpperCase()} reading scale</h3>
          <p>
            The type size and vertical rhythm move together while the document structure stays the
            same.
          </p>
        </Prose>
      ))}
    </Stack>
  );
}
```

## Bare elements

Prose styles bare headings, paragraphs, emphasis, links, ordered and unordered lists, blockquotes, inline code, preformatted blocks, tables, images, figures, descriptions, keyboard input, and separators. Its default reading measure is 42rem, the wrapper starts with no padding, and wide tables scroll inside that measure instead of expanding the page.

Elements that already carry a `className` keep their own component treatment. This lets `Link`, `Button`, `CodeBlock`, and other Zenos components sit inside Prose without being restyled as bare document content.

```tsx
<Prose>
  <p>
    A bare <a href="/guide">document link</a> receives the prose treatment.
  </p>
  <Link href="/workspace">Open workspace</Link>
</Prose>
```

## Custom spacing

`className` is merged after the defaults, so ordinary utilities can replace the reading measure and wrapper padding. Use the typed `--prose-*` variables through `style` when descendant rhythm or padding needs to change without rewriting the selectors.

```tsx
<Prose
  className="max-w-none p-6"
  style={{
    "--prose-block-gap": "2rem",
    "--prose-list-indent": "2rem",
    "--prose-pre-padding": "1.5rem",
  }}
>
  {content}
</Prose>
```

Available spacing variables are `--prose-block-gap`, `--prose-media-gap`, `--prose-list-indent`, `--prose-quote-padding`, `--prose-pre-padding`, `--prose-inline-code-padding-inline`, `--prose-inline-code-padding-block`, `--prose-cell-padding-inline`, and `--prose-cell-padding-block`.

## Rich HTML

Prose only styles descendants; it does not parse or sanitize HTML. Sanitize untrusted CMS or user-authored HTML before passing it to React.

```tsx
<Prose dangerouslySetInnerHTML={{ __html: sanitizedHtml }} />
```

## Sizes

sm, md, lg

## Anatomy

```text
Prose
```

## API

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| size | sm \| md \| lg | md | Selects the body type scale, heading scale, and vertical rhythm together. |
| as | ElementType | div | Renders a semantic wrapper such as article or section. |
| className | string | — | Extends the wrapper and descendant treatment with consumer-owned classes. |
| style | ProseStyle | — | Overrides native wrapper styles and the documented --prose-* spacing variables. |
| native props | React.HTMLAttributes<HTMLElement> | — | Forwards native attributes, events, aria-*, data-*, className, style, and ref. |

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

## Accessibility

Use meaningful document structure inside Prose: keep heading levels ordered, give links descriptive text, include alternate text for informative images, and add table headers and captions where they help readers. Choose `as="article"` or `as="section"` only when that landmark has an accessible purpose. Prose changes presentation without replacing native semantics.

Source: https://zenos-ui.pages.dev/components/prose/