# Typography Give rendered Markdown, articles and streaming text a consistent reading rhythm using semantic HTML and Forge theme tokens. [Interactive guide](/docs/components/typography) · Forge 3.2.0 Use the API for your installed version. Run `npx --no-install wss3-forge api --json` inside the project. ## Implementation guidance ### When to use it Use Typography for an article, rendered Markdown or a stream of structured prose. ### How to compose it Pass semantic headings, lists and tables into Typography. Use Heading and Text for individual labels and titles elsewhere in the interface. ### What to verify Verify that nested list markers, wide tables and media stay within the reading column. ## Usage ```tsx import { Typography, TypographyScroll } from 'wss3-forge' ``` - Wrap the HTML produced by your Markdown renderer or CMS in Typography. Use Heading and Text for individual interface labels and headings. - Choose docs, reading or compact for the surrounding context. The containing layout controls the line length. Change font size, line height and spacing independently using the three rhythm variables. - Keep heading levels in document order and supply meaningful link text. Text and surfaces follow the current Forge theme. - TypographyScroll preserves table semantics and becomes a focusable named region when the content overflows. - Use the not-typeset class or data-not-typeset on an embedded component to opt its entire subtree out of prose rules. The stylesheet uses low-specificity selectors so ordinary styles can override individual elements. ## Guide ### Size, leading and flow Size controls the body scale. Leading changes line height. Flow adds space before a new block. Use relative units to respect the surrounding font size. ```tsx {content} ``` ### Custom fonts and themes Body, heading and monospace families can be customized independently. Color and radius come from Forge tokens and follow theme changes. ```tsx {content} ``` ### Streaming content Each new block supplies its own preceding space. Adding a paragraph or a table row leaves the spacing of earlier content stable. ## Runnable examples ### Reading presets ```tsx import { useState } from 'react' import { HStack, Link, NativeSelect, Typography, VStack, type TypographyProps } from 'wss3-forge' function ReadingSample() { const [preset, setPreset] = useState>('docs') return setPreset(value as NonNullable)} style={{ width: 'fit-content' }}>

A guide to the night sky

A clear evening is enough to get started. Find an open space, turn off nearby lights and let your eyes adjust.

Find a reference point

Choose a bright star before looking for smaller constellations. In your notebook, record the local time and the direction you faced.

  • Look for a clear horizon.
  • Start with the brightest cluster.
A short observation repeated each night reveals more than a single long session.
Open the Typeset editorTypeset guide
} export default function Example() { return () } ``` ### Heading levels ```tsx import { Typography } from 'wss3-forge' export default function Example() { return (

Night sky observations

Seasonal guide

Winter constellations

Orion

) } ``` ### Lists ```tsx import { Typography } from 'wss3-forge' export default function Example() { return (

Before the first exposure, finish the equipment checklist.

  1. Level the tripod on firm ground.
  2. Pack the camera bag.
    • Include a spare battery for cold nights.
    • Keep the lens cloth in a dry pocket.
  3. Record the time and direction of the first observation in your notebook.
) } ``` ### Text treatments ```tsx import { Text, VStack } from 'wss3-forge' export default function Example() { return (Field notes from the night sky. Evening observationsObservation 12 Updated after sunset.) } ``` ### Responsive table ```tsx import { Typography, TypographyScroll } from 'wss3-forge' function ObservationTable() { return

Observation schedule

Compare start times for each site.

{['Site', 'Monday', 'Tuesday', 'Wednesday'].map(day => )}
All observations begin after sunset.
{day}
North ridge19:1519:2019:25
West field20:0520:1020:15
} export default function Example() { return () } ``` ### Overrides and opt-out ```tsx import { Card, CardContent, CardHeader, CardTitle, Typography } from 'wss3-forge' export default function Example() { return (

At the observatory

Visitors can join the observation from the east terrace.

Visitor hoursThursday, 19:00–21:30
) } ``` ### Streaming ```tsx import { useState } from 'react' import { Button, HStack, Typography, VStack } from 'wss3-forge' function StreamingReport() { const [count, setCount] = useState(1) const lines = ['The observing session began at 20:10.', 'Cloud cover cleared toward the northern ridge.', 'Three clusters were visible before moonrise.'] return

Observation log

{lines.slice(0, count).map(line =>

{line}

)}
} export default function Example() { return () } ``` ### RTL ```tsx import { Typography } from 'wss3-forge' export default function Example() { return (

دليل السماء الليلية

اختر مكاناً بعيداً عن الأضواء وسجّل وقت المشاهدة.

ابدأ بالنجوم الأكثر سطوعاً.
) } ``` ## Primitive libraries ### Base UI Use the root import for prose on its own. If your application already uses this primitive library, its Forge entry exports the same Typography component. ```sh npm install wss3-forge @base-ui/react ``` ```tsx import { Typography } from 'wss3-forge/base-ui' export default function Article() { return

Field notes

Record each observation while it is fresh.

} ``` ### Radix Use the root import for prose on its own. If your application already uses this primitive library, its Forge entry exports the same Typography component. ```sh npm install wss3-forge radix-ui ``` ```tsx import { Typography } from 'wss3-forge/radix' export default function Article() { return

Field notes

Record each observation while it is fresh.

} ``` ### React Aria Use the root import for prose on its own. If your application already uses this primitive library, its Forge entry exports the same Typography component. ```sh npm install wss3-forge react-aria-components ``` ```tsx import { Typography } from 'wss3-forge/react-aria' export default function Article() { return

Field notes

Record each observation while it is fresh.

} ``` ## Root package API ### Typography Give rendered Markdown, articles and streaming text a consistent reading rhythm using semantic HTML and Forge theme tokens. Props type: `TypographyProps` Native attributes: AriaAttributes, DOMAttributes, HTMLAttributes **Composition exports** - `TypographyScroll` (named export) - `as?` — `'article' | 'section' | 'div'` Default `'article'`. Options `"article"`, `"div"`, `"section"`. - `preset?` — `'docs' | 'reading' | 'compact'` Default `'docs'`. Options `"compact"`, `"docs"`, `"reading"`. A reading rhythm for documentation, long articles or small embedded passages. - `style?` — `CSSProperties & Partial>` - `ref?` — `React.LegacyRef | undefined` ### TypographyScroll Props type: `TypographyScrollProps` - `label` — `string` Accessible name for the horizontally scrollable region when its content overflows. - `children` — `ReactNode` - `style?` — `CSSProperties` ## Related types ```ts type TypesetVariable = '--typeset-size' | '--typeset-leading' | '--typeset-flow' | '--typeset-font-body' | '--typeset-font-heading' | '--typeset-font-mono' export interface TypographyProps extends HTMLAttributes { as?: 'article' | 'section' | 'div' /** A reading rhythm for documentation, long articles or small embedded passages. */ preset?: 'docs' | 'reading' | 'compact' style?: CSSProperties & Partial> } export interface TypographyScrollProps { /** Accessible name for the horizontally scrollable region when its content overflows. */ label: string children: ReactNode style?: CSSProperties } ``` ## Optional primitive contracts - [wss3-forge/base-ui · Typography contract](/ai/skill/primitive-api/Typography.json) - [wss3-forge/radix · Typography contract](/ai/skill/primitive-api/Typography.json) - [wss3-forge/react-aria · Typography contract](/ai/skill/primitive-api/Typography.json)