Docs
Typeset
Your markdown renderer outputs plain unstyled HTML — so you style the elements one by one, once per surface: blog, docs, chat. Typeset ends that repetition. It is one CSS file you own that styles everything inside a container, driven by three values. The specimens below show the scale; install the file to use it.
Install
Add the stylesheet to your project, then import it after Tailwind. The file lands in your repo — edit it directly whenever you need to.
pnpm dlx shadcn@latest add @davinciui/typeset@import "tailwindcss";
@import "./components/ui/typeset.css";Then wrap rendered markdown in typeset plus a preset:
<div className="typeset typeset-docs">
<YourMarkdownRenderer>{content}</YourMarkdownRenderer>
</div>typeset turns the styles on; the preset sets the rhythm. Use typeset-docs for articles, typeset-chat for messages, and typeset-compact for dense UI — all three can live in the same app.
Three controls
Everything derives from size, leading, and flow. Heading sizes, list indents, and gaps all follow these — set three values and the whole document obeys:
.typeset-docs {
--typeset-size: 15px; /* body font-size (1em follows the container) */
--typeset-leading: 1.75; /* line-height */
--typeset-flow: 1.5em; /* space between blocks */
}Fonts, colors, and radius come from your theme tokens automatically, so dark mode needs no extra work. For a one-off, skip the preset and set a value inline: className="typeset [--typeset-flow:1.75em]". Your own utilities and CSS always win over typeset styles — no !important needed.
Tables, opt-outs, and streaming
- Tables stay real tables. For wide ones, wrap in
typeset-scrollto scroll horizontally instead of breaking layout. - To keep a component untouched, add
not-typesetordata-not-typeset— it covers the component and everything inside it. - Streaming-safe by construction: spacing flows one way and no rule looks ahead, so appending a block never restyles the blocks above it.
Specimens
The scale below is what the presets render. One sans (Geist), one mono (JetBrains Mono), tight tracking on headings and relaxed leading on body. See Foundations → Typography for the underlying tokens.
Headings
Heading 1
text-4xl · font-semibold · tracking-tightThe quick brown fox jumps over the lazy dog
Heading 2
text-3xl · font-semibold · tracking-tightThe quick brown fox jumps over the lazy dog
Heading 3
text-2xl · font-semibold · tracking-tightThe quick brown fox jumps over the lazy dog
Heading 4
text-xl · font-semibold · tracking-tightThe quick brown fox jumps over the lazy dog
Body
Lead
A lead paragraph introduces the page. Larger, muted, and limited to two lines so it scans like a summary, not body copy.
Paragraph
This is standard body copy at 15px with a 28px line height. DavinciUI sets prose one step below the browser default and compensates with generous leading, which keeps dense documentation readable without feeling oversized.
Small + muted
Captions, timestamps and helper text. Muted foreground on the page background clears AA at this size — never place muted text on muted surfaces.
Inline code
Reference tokens like --background or utilities like text-foreground inline without breaking the line rhythm.
Blockquote + list
Good typesetting is invisible. If a reader notices the type before the words, the scale is doing too much.
- Headings: semibold, tight tracking, balanced wrapping.
- Body: regular weight, relaxed leading, left aligned.
- Code and labels: mono, one step down in size.
Usage guidance
- One
h1per page, thenh2for sections andh3for subsections — never skip levels for visual effect. - In component UI, prefer
text-sm leading-6for descriptions andtext-base leading-7for longer prose. - Reserve mono for code, keyboard input, and small labels — not for body copy.
- Keep prose line length under ~65 characters; the docs reading column enforces this for you.
Accessibility and readability
- Muted text must sit on the page background, never on muted surfaces — contrast fails otherwise.
- Left-align body copy; avoid centered paragraphs longer than two lines.
- Give links visible affordances (underline + offset) rather than color alone.
- Pair icon-only meaning with text or an accessible label — see Foundations → Icons.

