Text
Text sets body copy, labels and every other line that isn't a heading.
Text shows body copy, labels and short lines of information. Use it for everything that isn't a heading, and use Heading for the title of a page, a section or a card. Inside a sentence, use Code for a value people type, Kbd for a key and Link for a link.
size runs from 1 to 9 and defaults to 3, the body size. Each step sets the font size, the line height and the letter spacing together, so the line height always suits the size. Use 3 for reading and 2 for labels and details, and keep size 1 off composed screens.
weight is regular, medium or semibold, and defaults to regular. There is no bold, so show importance with size and colour instead.
emphasis sets the colour of the text. loud is the default and has full contrast, medium is muted, and quiet is faint. Because quiet falls below the contrast needed for comfortable reading, keep it for short lines that matter little. tone adds a meaning, such as success or destructive, and the three emphasis levels then use that tone's colours.
Without a tone, Text takes its colour from the surface it sits on, so it stays readable in light mode, in dark mode and on a strong fill. It renders a span with no margin, and render turns it into another element, such as render={<p />} or a label. Density doesn't change text size, but a touch screen makes the reading sizes a little larger.
Props
Generated from the types. It lists what this component DECLARES: a prop that arrives from a shared type or from the platform is real and is not repeated here.
| Prop | Type | What it does |
|---|---|---|
className? | string | Your classes, appended to the ones this component resolves rather than replacing them. |
emphasis? | "loud" | "medium" | "quiet" | The emphasis level of the text, which sets its colour. |
render? | RenderElement | Renders the text as a different element, such as a <p> or a <label>. |
size? | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | The text size step, from 1 to 9. |
style? | React.CSSProperties | Inline styles, merged last, so your value wins over anything the component resolved. |
tone? | "neutral" | "accent" | "destructive" | "blue" | "green" | "orange" | "amber" | "pink" | "purple" | "success" | "warning" | "info" | The meaning of the text, which sets its colour family, such as destructive. |
weight? | "regular" | "medium" | "semibold" | The font weight: regular, medium or semibold. |
It also takes every prop of a <span>.
- A colour prop — Use
toneto say what the text means, and the theme picks a colour that works in light and dark mode. For a one-off colour, set it instyle. margin— Text never adds space around itself, even whenrendermakes it a paragraph. Set the space between blocks withgapon a Stack.bold(700) — Semibold is the heaviest weight. Show what matters most with a larger size or a stronger emphasis instead.