Displays a basic text primitive.
This component is based on the span
element and supports common margin props m
, mx
, my
, ml
, mr
, mt
, mb
. View source
Use the as
prop to render text as a div or paragraph. This prop is purely semantic and does not change the visual appearance of the text.
Use the color
prop to control the color of the text. The colors are accessible over the canvas color and over steps 1 and 2 of the color scales.
Use the align
prop to set text alignment. You can change the alignment across breakpoints using the object syntax.
Use the size
prop to control the size of the text. The prop also provides correct line height and corrective letter spacing – as text size increases, the relative line height and letter spacing decrease.
You can change the size across breakpoints using the object syntax.
Sizes 2 – 4 are designed to work well for long-form content.
Sizes 1 – 3 are designed to work well for UI labels.
Use the trim
prop to trim the leading space at the start, end, or both sides of the text box. You can change the leading trim across breakpoints using the object syntax.
The prop works similarly to the upcoming half-leading control spec, but uses a common negative margin workaround under the hood for cross-browser support.
Trimming the leading is useful when dialing in vertical spacing in cards or other “boxy” components. Otherwise, the card padding looks larger on top and bottom than on the sides.
Use the weight
prop to set the weight of the text. You can change the weight across breakpoints using the object syntax.