Layout & primitives
Typography
Free1.8 KB gzippedFour components for text: Display for hero headlines, Heading for section titles, Text for running copy, and Eyebrow for the small label above a heading. Each one separates the semantic element (level or as) from its visual size, so the document outline never has to bend to the design.
Accessibility: WCAG 2.2 AA · No A or AA violations in light or dark mode · No keyboard interaction of its own · Full report
Import
import { Heading, Display, Text, Eyebrow } from "@vjdesigns/vjdesigns-ui";
Importing only Typography adds about 1.8 KB of minified, gzipped JavaScript to your app (React not included). The stylesheet is shared by every component and loaded once: 75.1 KB gzipped.
Examples
Hierarchy
The display font for headlines and headings, the body font for text. level sets the element; size sets the look.
Case study
Shipping faster with fewer bugs
How one team cut review time in half
Six months after adopting a shared component library, the team spends less time on UI details and more on the product.
import {
Display,
Eyebrow,
Heading,
Stack,
Text,
} from "@vjdesigns/vjdesigns-ui";
export function Hierarchy() {
return (
<Stack gap={3} style={{ width: "100%", maxWidth: "34rem" }}>
<Eyebrow>Case study</Eyebrow>
<Display level={2} size="4xl">
Shipping faster with fewer bugs
</Display>
<Heading level={3} size="xl">
How one team cut review time in half
</Heading>
<Text tone="muted" leading="relaxed">
Six months after adopting a shared component library, the team spends less time on UI details and more on the
product.
</Text>
</Stack>
);
}
Text styles
Large text for introductions
Default body text
Small, muted text for supporting details
Bold and primary
Monospaced: 0123456789
All caps label
import { Stack, Text } from "@vjdesigns/vjdesigns-ui";
export function TextStyles() {
return (
<Stack gap={2}>
<Text size="lg">Large text for introductions</Text>
<Text>Default body text</Text>
<Text size="sm" tone="muted">
Small, muted text for supporting details
</Text>
<Text weight="bold" tone="primary">
Bold and primary
</Text>
<Text mono size="sm">
Monospaced: 0123456789
</Text>
<Text caps size="xs" weight="semibold">
All caps label
</Text>
</Stack>
);
}
Truncation
truncate cuts one line with an ellipsis; lineClamp does the same after several lines.
Accessible, themeable components with light and dark modes, five brand palettes, and TypeScript types for every prop, ready to drop into your next project.
Accessible, themeable components with light and dark modes, five brand palettes, and TypeScript types for every prop, ready to drop into your next project.
import { Stack, Text } from "@vjdesigns/vjdesigns-ui";
export function Truncation() {
const long =
"Accessible, themeable components with light and dark modes, five brand palettes, and TypeScript types for every prop, ready to drop into your next project.";
return (
<Stack gap={4} style={{ width: "100%", maxWidth: "20rem" }}>
<Text truncate>{long}</Text>
<Text lineClamp={2} tone="muted">
{long}
</Text>
</Stack>
);
}
Accessibility
The semantic level and the visual size are separate: this Heading is an <h3> in the outline but small on screen. truncate and lineClamp only clip visually; the full text stays in the page for screen readers.
Order summary
Wireless noise-cancelling headphones, midnight blue, with travel case
import { Heading, Stack, Text } from "@vjdesigns/vjdesigns-ui";
export function Accessibility() {
return (
<Stack gap={2} style={{ width: "100%", maxWidth: "20rem" }}>
<Heading level={3} size="md">
Order summary
</Heading>
<Text truncate>Wireless noise-cancelling headphones, midnight blue, with travel case</Text>
</Stack>
);
}
Translated
LocaleProvider sets lang="ja", so browsers pick Japanese fonts and line-breaking rules and screen readers use Japanese. The text is your own.
お知らせ
新しいダッシュボード
よく使う数値を、ひと目で確認できるようになりました。
import {
Eyebrow,
Heading,
Stack,
Text,
LocaleProvider,
} from "@vjdesigns/vjdesigns-ui";
import ja from "@vjdesigns/vjdesigns-ui/locales/ja";
export function Translated() {
return (
<LocaleProvider locale="ja" messages={ja}>
<Stack gap={2} style={{ width: "100%", maxWidth: "24rem" }}>
<Eyebrow>お知らせ</Eyebrow>
<Heading level={3} size="xl">
新しいダッシュボード
</Heading>
<Text tone="muted">よく使う数値を、ひと目で確認できるようになりました。</Text>
</Stack>
</LocaleProvider>
);
}
Right to left
The first example again, inside a right-to-left LocaleProvider (Arabic). Layout, spacing and arrow icons mirror, and the components' built-in text is translated. The example's own text stays in English.
Hierarchy
Case study
Shipping faster with fewer bugs
How one team cut review time in half
Six months after adopting a shared component library, the team spends less time on UI details and more on the product.
import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ar from "@vjdesigns/vjdesigns-ui/locales/ar";
// Hierarchy is the "Hierarchy" example above.
<LocaleProvider locale="ar" messages={ar}>
<Hierarchy />
</LocaleProvider>
API reference
Heading
Athletic display heading in --font-display: bold, tight, high contrast. level sets the semantics; size sets the look.
| Prop | Type | Default |
|---|---|---|
levelSemantic level; renders | 123456 | — |
sizeVisual size, independent of | "xs""sm""md""lg""xl""2xl""3xl""4xl""5xl""6xl" | — |
balanceBalance line lengths ( | boolean | — |
weightFont weight. | "regular""medium""semibold""bold""black" | — |
toneText color, from contrast-verified tokens. | "default""muted""primary""accent""success""warning""danger""info""inherit" | — |
alignHorizontal alignment. | "start""center""end""justify" | — |
capsUppercase with wide | boolean | — |
truncateKeep to one line and cut off with an ellipsis. The full text stays in the DOM for screen readers; give sighted users a way to see it (e.g. | boolean | — |
lineClampClamp to this many lines, ending in an ellipsis. | number | — |
classNameAdditional class names, merged with the component's own. | string | — |
styleInline styles, merged with the dynamic | CSSProperties | — |
asThe element to render. | "h1""h2""h3""h4""h5""h6""p""span""div""legend" | — |
Also accepts standard HTML attributes, plus className, style and ref.
Display
Hero-sized heading: Heading with level={1}, size="6xl", and weight="black" by default. Every Heading prop still applies.
| Prop | Type | Default |
|---|---|---|
levelSemantic level; renders | 123456 | — |
sizeVisual size, independent of | "xs""sm""md""lg""xl""2xl""3xl""4xl""5xl""6xl" | — |
balanceBalance line lengths ( | boolean | — |
weightFont weight. | "regular""medium""semibold""bold""black" | — |
toneText color, from contrast-verified tokens. | "default""muted""primary""accent""success""warning""danger""info""inherit" | — |
alignHorizontal alignment. | "start""center""end""justify" | — |
capsUppercase with wide | boolean | — |
truncateKeep to one line and cut off with an ellipsis. The full text stays in the DOM for screen readers; give sighted users a way to see it (e.g. | boolean | — |
lineClampClamp to this many lines, ending in an ellipsis. | number | — |
classNameAdditional class names, merged with the component's own. | string | — |
styleInline styles, merged with the dynamic | CSSProperties | — |
asThe element to render. | "h1""h2""h3""h4""h5""h6""p""span""div""legend" | — |
Also accepts standard HTML attributes, plus className, style and ref.
Text
Friendly body text in --font-body. Renders a p by default.
| Prop | Type | Default |
|---|---|---|
sizeFont size. Block elements default to | "sm""md""lg""xs""xl""2xl""inherit" | — |
toneText color. Block elements default to | "default""muted""primary""accent""success""warning""danger""info""inherit" | — |
leadingLine height. Defaults to | "tight""snug""normal""relaxed" | — |
italicItalic style. | boolean | — |
monoUse the monospace font ( | boolean | — |
wrapLine wrapping behavior. | "wrap""nowrap""balance""pretty" | — |
weightFont weight. | "regular""medium""semibold""bold""black" | — |
alignHorizontal alignment. | "start""center""end""justify" | — |
capsUppercase with wide | boolean | — |
truncateKeep to one line and cut off with an ellipsis. The full text stays in the DOM for screen readers; give sighted users a way to see it (e.g. | boolean | — |
lineClampClamp to this many lines, ending in an ellipsis. | number | — |
classNameAdditional class names, merged with the component's own. | string | — |
styleInline styles, merged with the dynamic | CSSProperties | — |
asThe element to render. | TextElement | — |
Also accepts standard HTML attributes, plus className, style and ref.
Eyebrow
Short uppercase overline above a heading, in the display font. Text with caps, weight="bold", size="sm", and tone="primary" by default. Renders a p by default; it is not a heading, so it is not in the outline.
| Prop | Type | Default |
|---|---|---|
sizeFont size. Block elements default to | "sm""md""lg""xs""xl""2xl""inherit" | — |
toneText color. Block elements default to | "default""muted""primary""accent""success""warning""danger""info""inherit" | — |
leadingLine height. Defaults to | "tight""snug""normal""relaxed" | — |
italicItalic style. | boolean | — |
monoUse the monospace font ( | boolean | — |
wrapLine wrapping behavior. | "wrap""nowrap""balance""pretty" | — |
weightFont weight. | "regular""medium""semibold""bold""black" | — |
alignHorizontal alignment. | "start""center""end""justify" | — |
capsUppercase with wide | boolean | — |
truncateKeep to one line and cut off with an ellipsis. The full text stays in the DOM for screen readers; give sighted users a way to see it (e.g. | boolean | — |
lineClampClamp to this many lines, ending in an ellipsis. | number | — |
classNameAdditional class names, merged with the component's own. | string | — |
styleInline styles, merged with the dynamic | CSSProperties | — |
asThe element to render. | TextElement | — |
Also accepts standard HTML attributes, plus className, style and ref.
See what changed in each version in the Changelog.
Accessibility report
Typography targets WCAG 2.2 AA. Below: a live axe-core audit of this page's examples, Lighthouse scores for the page in both modes, the accessibility behavior built into the component, and the checks only a person can do.
axe-core audit (live)
Checking the examples above…
Lighthouse audit
Light mode
Score 10035 passed · 0 failed · 30 not applicable · 10 to check by hand
Dark mode
Score 10035 passed · 0 failed · 30 not applicable · 10 to check by hand
Lighthouse 13.5.0 audits the whole docs page (header and sidebar included), not just the examples, in English. Last run 11/27/2026. Some failed audits carry no weight in the score, so a page can score 100 and still list one.
Built-in behavior
Keyboard
Not focusable, so there's no keyboard interaction of its own.
Roles and states
| Element | Role | States and properties |
|---|---|---|
Heading, Display | heading | Level from level (<h1>–<h6>), separate from the visual size |
Text, Eyebrow | none (generic) or paragraph | Element from as |
Manual checks
Automated tools find roughly a third of accessibility issues. Test these in your app, with your content.
| Check | What to test | WCAG 2.2 |
|---|---|---|
| Keyboard | Every action works with Tab, Shift+Tab, Enter, Space and the arrow keys, and focus never gets stuck. | 2.1.1 (A), 2.1.2 (A) |
| Focus | Focus moves in a logical order, is always visible, and isn't hidden behind sticky headers. | 2.4.3 (A), 2.4.7 (AA), 2.4.11 (AA), 2.4.13 (AAA) |
| Screen readers | Names, roles and states are announced correctly, and status changes are announced without moving focus. | 1.3.1 (A), 4.1.2 (A), 4.1.3 (AA) |
| Color | Meaning never depends on color alone; your own colors meet contrast in both modes. | 1.4.1 (A), 1.4.3 (AA), 1.4.11 (AA), 1.4.6 (AAA) |
| Zoom and reflow | At 200% text size and at 320px wide (400% zoom), nothing is cut off and no sideways scrolling is needed. | 1.4.4 (AA), 1.4.10 (AA), 1.4.12 (AA) |
| Pointer targets | Click and tap targets are at least 24×24px (44×44px for AAA), or spaced so they don't overlap. | 2.5.8 (AA), 2.5.5 (AAA) |
| Motion | Animations respect the reduced-motion setting. | 2.3.3 (AAA) |