Components
Text
Typographic primitive with the full size scale, weights, families, and overflow controls.
Text renders a span by default and provides the token-driven typography options shared by the rest
of the typography family. It accepts any element through as, so it
can also render paragraphs, headings, and list content.
Live preview#
import { Stack, Text } from '@orkest/ui';
export function Example() {
return (
<Stack gap={2}>
<Text size="xl" weight="semibold">
Design with clarity
</Text>
<Text size="md">Primary body copy stays comfortable to read.</Text>
<Text size="sm" tone="muted">
Secondary details recede without becoming unreadable.
</Text>
</Stack>
);
}Font families#
<Stack gap={2}>
<Text font="display" size="xl" weight="semibold">
Build with clarity.
</Text>
<Text font="mono" size="sm">
const ui = "orkest";
</Text>
<Text font="numeric" size="sm">
1,248.50 · 12:45 · 01 02 03
</Text>
</Stack>Sizes and weights#
Text supports the full type scale from 2xs to 5xl, plus inherit for nested inline content.
Weights are regular, medium, semibold, and bold.
<Stack gap={1}>
<Text size="2xs">2xs · 12px</Text>
<Text size="xs">xs · 13px</Text>
<Text size="sm">sm · 14px</Text>
<Text size="md">md · 16px</Text>
<Text size="lg">lg · 18px</Text>
<Text size="xl" weight="bold">
xl · 20px bold
</Text>
<Text size="2xl">2xl · 24px</Text>
<Text size="3xl">3xl · 30px</Text>
<Text size="4xl">4xl · 38px</Text>
<Text size="5xl">5xl · 48px</Text>
</Stack>Style options#
Centered muted text
<Stack gap={2}>
<Text lineHeight="relaxed" letterSpacing="wide">
Relaxed line height with wide tracking.
</Text>
<Text italic>Italic text</Text>
<Text underline>Underlined text</Text>
<Text as="p" align="center" tone="muted">
Centered muted text
</Text>
</Stack>Overflow#
truncate is single-line; lineClamp is multi-line and takes precedence when both are set. The full
text stays in the DOM.
Single-line truncation keeps long copy from wrapping onto a second line.
Multi-line clamping stops after two lines and hides the remainder, which is useful for previews and summaries.
<Box style={{ width: '22rem' }}>
<Stack gap={2}>
<Text as="p" truncate>
Single-line truncation keeps long copy from wrapping onto a second line.
</Text>
<Text as="p" lineClamp={2}>
Multi-line clamping stops after two lines and hides the remainder, which is useful for
previews and summaries.
</Text>
</Stack>
</Box>Props#
| Prop | Type | Default |
|---|---|---|
size | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | 'inherit' | 'md' |
| Font size and matching line height. inherit keeps the surrounding size. | ||
weight | 'regular' | 'medium' | 'semibold' | 'bold' | 'regular' |
| Font weight token. | ||
tone | 'default' | 'muted' | 'subtle' | 'inherit' | 'accent' | 'success' | 'danger' | 'default' |
| Semantic text color. This is the color control for Text. | ||
align | 'start' | 'center' | 'end' | 'justify' | 'start' |
| Text alignment. | ||
font | 'sans' | 'display' | 'mono' | 'numeric' | 'sans' |
| Font family. Display is intended for large headings; mono for code; numeric keeps Inter with tabular figures so digits align. | ||
lineHeight | 'tight' | 'snug' | 'normal' | 'relaxed' | — |
| Overrides the line height selected by the size. | ||
letterSpacing | 'tighter' | 'tight' | 'normal' | 'wide' | — |
| Overrides the letter spacing selected by the size. | ||
truncate | boolean | false |
| Single-line overflow with an ellipsis. The element switches to block layout so clipping works. | ||
lineClamp | number | — |
| Clamps text to the given number of lines. Takes precedence over truncate. | ||
italic | boolean | false |
| Applies italic styling. Use Strong for emphasis semantics. | ||
underline | boolean | false |
| Applies an underline with token-based thickness and offset. | ||
as | ElementType | 'span' |
| Element to render. | ||
native attributes | ComponentPropsWithRef<T> | — |
| Inherited from the element selected by as, including ref forwarding. | ||
Accessibility#
Textdefaults to a span. Useasto render the correct semantic element.- Do not skip heading levels. A visual size does not determine the heading level; use Heading for headings.
- Truncation and line clamping are visual; the full text remains in the DOM for assistive technology.
- Tone is not a substitute for context. Pair success or danger text with a clear label or icon.
- Inherited native attributes such as
id,title, and event handlers are forwarded.
Related#
- Typography for the semantic text component family.
- Typography foundations for the full type scale and tokens.
- Stack for vertical rhythm.