nook
Browse the docs

Components

Typography

Native

Headings, text sizes and a Prose wrapper that styles plain HTML.

See the prompt

Ship it calmly.

A tidy set of type sizes, so a page reads the same wherever it is placed.

Body text for paragraphsSmall textMuted help textLabelnpx nook add button

Prose styles plain HTML

Use it for content you do not write by hand, such as Markdown or the Rich Text Editor. It sets headings, lists, quotes and inline code at a comfortable reading width.

  • Headings keep their order in the outline
  • Links are underlined, never only colored
Good type is mostly spacing.

Installation

npx nook-ui@latest add typography

Prompt

Paste this into your AI coding assistant. It adds this exact component, the same way the CLI does, and tells the assistant how to use it.

Short. For assistants that can run commands in your project.

Plain text
Add the Nook "Typography" component to this project, exactly as Nook ships it.

Headings, text sizes and a Prose wrapper that styles plain HTML.

Steps
1. Check for `nook.json` in the project root. If it is missing, run `npx nook-ui@latest init` first (React or Next.js with Tailwind CSS v4). It adds the Nook tokens, the theme and `cn()`.
2. Run `npx nook-ui@latest add typography`. It writes `components/ui/typography.tsx` together with everything the component needs. Do not write the component from memory.
3. If you cannot run commands, fetch http://localhost:3000/r/typography.json, write every entry of `files` to the path it names, install the packages in `dependencies`, and repeat for each name in `registryDependencies`.
4. Use it where I ask. Start from this example:

```tsx
import { Heading, Prose, Text } from "@/components/ui/typography";

export default function TypographyDefault() {
  return (
    <div className="grid w-full gap-8">
      <div className="grid gap-3">
        <Heading level={1} size="display">Ship it calmly.</Heading>
        <Text variant="lead">A tidy set of type sizes, so a page reads the same wherever it is placed.</Text>
        <div className="flex flex-wrap items-baseline gap-x-6 gap-y-2">
          <Text variant="body" as="span">Body text for paragraphs</Text>
          <Text variant="small" as="span">Small text</Text>
          <Text variant="muted" as="span">Muted help text</Text>
          <Text variant="label" as="span">Label</Text>
          <Text variant="code">npx nook add button</Text>
        </div>
      </div>
      <Prose>
        <h2>Prose styles plain HTML</h2>
        <p>
          Use it for content you do not write by hand, such as Markdown or the <a href="#editor">Rich Text Editor</a>. It sets headings,
          lists, quotes and <code>inline code</code> at a comfortable reading width.
        </p>
        <ul>
          <li>Headings keep their order in the outline</li>
          <li>Links are underlined, never only colored</li>
        </ul>
        <blockquote>Good type is mostly spacing.</blockquote>
      </Prose>
    </div>
  );
}
```

API
- `Heading`: A heading.
  - `level` (`1 | 2 | 3 | 4 | 5 | 6`, default 2): The heading element.
  - `size` (`"display" | "h1" | "h2" | "h3" | "h4"`): How big it looks. Defaults to match the level.
- `Text`: Running text.
  - `variant` (`"body" | "lead" | "small" | "muted" | "label" | "code"`, default "body"): The size and tone.
  - `as` (`"p" | "span" | "div" | "code" | "small" | "strong" | "em"`): The element to render.
- `Prose`: Styles the HTML inside it: headings, lists, quotes, code, tables and links, at a readable width.

Rules
- Colors, radii, shadows and motion come from Nook tokens and classes such as `bg-primary`, `text-muted-foreground`, `border-border`, `rounded-lg` and `h-control`. Never hard-code them.
- Do not restyle or simplify the file. Change how it looks through `className`, its props and the theme.
- It must keep working with the keyboard, in light and dark mode, and in the sharp, soft and bold styles.
- Accessibility: `Heading` separates the level (its place in the outline) from the size (how it looks), so the outline stays correct whatever the design. Links in Prose are underlined, never only colored.

Done when the component renders like the example in light and dark mode and the project type-checks.

Usage

import { Heading, Prose, Text } from "@/components/ui/typography";

export default function TypographyDefault() {
  return (
    <div className="grid w-full gap-8">
      <div className="grid gap-3">
        <Heading level={1} size="display">Ship it calmly.</Heading>
        <Text variant="lead">A tidy set of type sizes, so a page reads the same wherever it is placed.</Text>
        <div className="flex flex-wrap items-baseline gap-x-6 gap-y-2">
          <Text variant="body" as="span">Body text for paragraphs</Text>
          <Text variant="small" as="span">Small text</Text>
          <Text variant="muted" as="span">Muted help text</Text>
          <Text variant="label" as="span">Label</Text>
          <Text variant="code">npx nook add button</Text>
        </div>
      </div>
      <Prose>
        <h2>Prose styles plain HTML</h2>
        <p>
          Use it for content you do not write by hand, such as Markdown or the <a href="#editor">Rich Text Editor</a>. It sets headings,
          lists, quotes and <code>inline code</code> at a comfortable reading width.
        </p>
        <ul>
          <li>Headings keep their order in the outline</li>
          <li>Links are underlined, never only colored</li>
        </ul>
        <blockquote>Good type is mostly spacing.</blockquote>
      </Prose>
    </div>
  );
}

Examples

Headings

Ship calmer

Release notes

What changed in March

Search

Filters

Text variants

Plan your week in minutes, not hours.

Body text for longer explanations sits at a comfortable reading size.

Small text for secondary content.

Muted text for hints and metadata.

UPDATED 2 HOURS AGO

Run pnpm dev to start.

Article

Field notes

Why we slowed down our releases

Shipping weekly felt fast, but support tickets doubled.

Last spring we moved to a release every Friday. Customers noticed the rhythm, and so did our on-call engineers.

What we measured

  • Bugs reported within 48 hours
  • Time spent on rollbacks
A release is only done when nobody has to think about it.

Props

Heading

A heading.

PropTypeDefaultDescription
level1 | 2 | 3 | 4 | 5 | 62The heading element.
size"display" | "h1" | "h2" | "h3" | "h4"–How big it looks. Defaults to match the level.

Text

Running text.

PropTypeDefaultDescription
variant"body" | "lead" | "small" | "muted" | "label" | "code""body"The size and tone.
as"p" | "span" | "div" | "code" | "small" | "strong" | "em"–The element to render.

Prose

Styles the HTML inside it: headings, lists, quotes, code, tables and links, at a readable width.

Accessibility

`Heading` separates the level (its place in the outline) from the size (how it looks), so the outline stays correct whatever the design. Links in Prose are underlined, never only colored.

Checked against WCAG 2.1 AA with automated axe tests and keyboard tests on every release.