Typography

Automatic prose styling and semantic text primitives for documentation and content-heavy interfaces.

Installation

npx shadcn@latest add @fulldev/typography

Typeset

Typography uses the recommended shadcn Typeset stylesheet. Typeset applies one readable scale and vertical rhythm to semantic HTML, including headings, paragraphs, links, lists, code, blockquotes, media, and tables. It also supports task lists, footnotes, definition lists, keyboard keys, and print styles.

Usage

Use Typography as a wrapper around rendered content, markdown output, or regular HTML when you want the component to style its children automatically. Use the individual typography components when you want explicit primitives in a component example or custom layout.

Every typography component accepts size="sm", size="default", or size="lg". On Typography, the size preset changes the body size, line height, and flow spacing together so the whole document keeps a consistent rhythm. The default preset uses a 1rem body size, 1.75 line height, and 1.25em flow spacing. Use the individual components’ size prop when a standalone element needs a different size.

import {
  Typography,
  TypographyA,
  TypographyBlockquote,
  TypographyH1,
  TypographyH2,
  TypographyH3,
  TypographyH4,
  TypographyInlineCode,
  TypographyLead,
  TypographyList,
  TypographyListItem,
  TypographyP,
  TypographyTable,
  TypographyTableCell,
  TypographyTableHead,
  TypographyTableRow,
} from "@/components/ui/typography"

Child elements

The Typography wrapper styles supported child elements directly. Headings, paragraphs, links, blockquotes, lists, tables, inline code, and preformatted code can be regular HTML.

Opt out

Add data-not-typeset or class="not-typeset" to an embedded interface that should keep its component styles. The opt-out includes every descendant, so put it on the smallest wrapper that owns the interface. A nested Typography cannot reactivate Typeset inside an opted-out subtree.

<Typography as="article">
  <p>This paragraph uses Typeset.</p>

  <div data-not-typeset>
    <YourInteractiveComponent />
  </div>
</Typography>

Child components

The standalone parts render their semantic element with Tailwind classes. They preserve the same size props without depending on a Typography ancestor.

TypographyH1

TypographyH2

TypographyH3

TypographyH4

TypographyP

TypographyA

TypographyBlockquote

TypographyTable

TypographyList

TypographyInlineCode

TypographyLead

Notes

  • Wrap long-form prose in Typography when you want sensible defaults for headings, paragraphs, lists, tables, and inline code.
  • Use the individual typography primitives when you want explicit semantic composition inside a component example or a custom layout.
  • Wrap wide tables or other wide content in class="typeset-scroll" to retain native table semantics with horizontal overflow.

API Reference

See the GitHub source code for more information on props.