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 (
Ship it calmly.
A tidy set of type sizes, so a page reads the same wherever it is placed.
Body text for paragraphs
Small text
Muted help text
Label
npx 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.
);
}
```
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.