Typography

Unified typography system for consistent text styling across your application.

Overview

The Typography system provides consistent text styling for documents, articles, and MDX content. It includes individual text components and an MDX components map that can be passed directly to your MDX renderer.

MDX Components

The mdxComponents object maps HTML tags to styled React components. Pass it to your MDX renderer for automatic styling.

import { mdxComponents } from "@/registry/components/typography"
import { Content } from "astro:content"

<Content components={mdxComponents} />

Supported elements: h1h6, p, a, blockquote, ul, ol, li, pre, code, em, strong, hr, br, img, del, table, thead, tbody, tr, th, td.

Individual Components

Each typography element is exported as a named component for use outside MDX:

import { H1, H2, P, A, Blockquote } from "@/registry/components/typography"

function MyPage() {
  return (
    <>
      <H1>Page Title</H1>
      <P>Body text with a <A href="/docs">link</A>.</P>
      <Blockquote>A meaningful quote.</Blockquote>
    </>
  )
}

Code Block Integration

Fenced code blocks in MDX are automatically rendered with the CodeBlock component, providing syntax highlighting with a Mac terminal style.

```tsx
const greeting = "Hello, world!"
console.log(greeting)
```

The integration detects the language-xxx class on <code> elements and delegates rendering to CodeBlock with the appropriate language.

Available Components

ComponentHTML TagDescription
H1H6h1h6Heading levels with scroll-margin and tracking
PpParagraph with comfortable line height
AaLink with underline and external detection
BlockquoteblockquoteStyled quote with left border
Ul / Olul / olLists with disc/decimal markers
LiliList item with comfortable line height
PrepreCode block (delegates to CodeBlock for syntax)
InlineCodecodeInline code with background
EmemItalic emphasis
StrongstrongBold emphasis
HrhrHorizontal rule
ImgimgResponsive image with rounded corners
DeldelStrikethrough text
MdxTabletableTable wrapper with overflow