Text
Native Solid 2 fork. Original documentation and designs © WorkOS; historical posts retain their original context.
API Reference
This component is based on the span element and supports common margin props.
Examples
As another element
Use the as prop to render text as a p, label, div or span. This prop is purely semantic and does not alter visual appearance.
This is a paragraph element.
Size
Use the size prop to control text size. This prop also provides correct line height and corrective letter spacing—as text size increases, the relative line height and letter spacing decrease.
Sizes 2–4 are designed to work well for long-form content.
The goal of typography is to relate font size, line height, and line width in a proportional way that maximizes beauty and makes reading easier and more pleasant. The question is: What proportion(s) will give us the best results? The golden ratio is often observed in nature where beauty and utility intersect; perhaps we can use this “divine” proportion to enhance these attributes in our typography.
The goal of typography is to relate font size, line height, and line width in a proportional way that maximizes beauty and makes reading easier and more pleasant. The question is: What proportion(s) will give us the best results? The golden ratio is often observed in nature where beauty and utility intersect; perhaps we can use this “divine” proportion to enhance these attributes in our typography.
The goal of typography is to relate font size, line height, and line width in a proportional way that maximizes beauty and makes reading easier and more pleasant. The question is: What proportion(s) will give us the best results? The golden ratio is often observed in nature where beauty and utility intersect; perhaps we can use this “divine” proportion to enhance these attributes in our typography.
Sizes 1–3 are designed to work well for UI labels.
Weight
Use the weight prop to set the text weight.
Align
Use the align prop to set text alignment.
Trim
Use the trim prop to trim the leading space at the start, end, or both sides of the text box.
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, padding looks larger on top and bottom than on the sides.
Without trim
The goal of typography is to relate font size, line height, and line width in a proportional way that maximizes beauty and makes reading easier and more pleasant.With trim
The goal of typography is to relate font size, line height, and line width in a proportional way that maximizes beauty and makes reading easier and more pleasant.The default trim values are configured for the system font stack that’s used by Radix Themes. If you are using custom fonts, you can adjust the trim values using the corresponding CSS variables.
Truncate
Use the truncate prop to truncate text with an ellipsis when it overflows its container.
Wrap
Use the wrap prop to control text wrapping.
text-wrap: pretty is an experimental value that is not yet supported in all browsers. However, it can be treated as a progressive enhancement for browsers that do support it.
Color
Use the color prop to assign a specific color. The text colors are designed to achieve at least Lc 60 APCA contrast over common background colors.
High-contrast
Use the highContrast prop to increase color contrast with the background.
With formatting
Compose Text with formatting components to add emphasis and structure to content.
Look, such a helpful link, an italic emphasis, a piece of computer code, and even a hotkey combination ⇧⌘A within the text.
With form controls
Composing Text with a form control like Checkbox, RadioGroup, or Switch automatically centers the control with the first line of text, even when the text is multi-line.