Text
Slant / Primitives
Title, body, hint, label and monospace text on the theme's type scale, as any element.
Demo
Usage
import { Text } from '@tuttn/slant'
<Text variant="title" as="h2">Checkpoints</Text> // a heading needs as
<Text>Saved every five minutes.</Text> // body, a <p>
<Text muted>Last saved 2m ago.</Text>
<Text variant="hint">Applies to every branch.</Text>
<Text variant="mono">TASK-24</Text> // label and mono are spans
// as picks the element; htmlFor and dateTime go with label and time.
<Text as="label" variant="label" htmlFor="branch">Branch</Text>
<Text as="time" variant="mono" dateTime="2026-10-30T09:12">09:12</Text>Props
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'body' | 'title' | 'hint' | 'label' | 'mono' | 'body' | body: 13px copy · title: a 14px semibold heading · hint: 12px muted · label: uppercase mono · mono: 12px mono |
muted | boolean | — | The secondary text colour. |
as | 'p' | 'span' | 'div' | 'h2' | 'h3' | 'h4' | 'strong' | 'label' | 'time' | 'dt' | 'dd' | 'legend' | 'caption' | 'span' for label and mono, else 'p' | The element to render. |
htmlFor | string | — | The control a label names, with as="label". |
dateTime | string | — | The machine-readable date, with as="time". |
…rest | HTMLAttributes | — | className, style, id and every other attribute go on the element, and a ref reaches it. |
Accessibility
variantchanges only the look;aspicks the element. A title is a<p>until you passas="h2"(or h3, h4), and only then is it a heading screen readers can jump to.- The label variant is a
<span>. To name a control, make it a real label:as="label"withhtmlFor. - Muted and hint text hold 4.5:1 against the theme's background and surfaces in every theme.