Text
Text on the system's type scale.
Text is the system’s type scale. It’s the only place that sets font size, weight, family,
line height or tracking. Every other component styles its text with textVariants, the same
scale as a class string. The sync check fails when a component, block or example sets a size or
weight itself.
It renders a <p>. Give it render for another element, like <span /> inside a sentence.
For headings, put textVariants on the heading itself, so the heading keeps its content where
accessibility checks can see it. Without size, text inherits the size around it.
Sizes
Each step sets a line height to match. control is for form fields: md on narrow screens, so
iOS doesn’t zoom into a focused field, then sm.
Weights and families
Dependencies
What it's built from and what's built from it in Shell, read from the imports in its source.
| Uses | Nothing else in the system. |
|---|---|
| Used by | Buttonprimitive |
| Packages | None. |
Installation
Set the project up for Shell once first, as Getting started shows. Then copy the source:
API reference
Generated from Shell's types. Props marked ours are added here; the rest come from
the nsh/base part it wraps. Every part also takes nsh's view props, like class, style and testID.
Text
Text on the type scale: a size, weight and tone, the body size and the foreground by default.
- classours
Classes for layout, after the type scale's.
Type string
- sizeours
A step on the type scale.
Type "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" · Default md
- toneours
The text's color.
Type TextTone · Default default
- truncateours
One line, cut off with an ellipsis.
Type boolean
- weightours
Type TextWeight
textSizes
The size names, smallest first.
Takes the props of a native div.
textVariants
The classes for a size, weight, tone and truncation, for components that draw their own text.
- sizeours
A step on the type scale.
Type "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl"
- toneours
The text's color.
Type TextTone
- truncateours
One line, cut off with an ellipsis.
Type boolean · Default false
- weightours
Type TextWeight