Heading
Native Solid 2 fork. Original documentation and designs © WorkOS; historical posts retain their original context.
The quick brown fox jumps over the lazy dog
API Reference
This component is based on the h1 element and supports common margin props.
Examples
As another element
Use the as prop to change the heading level. This prop is purely semantic and does not change the visual appearance.
Level 1
Level 2
Level 3
Size
Use the size prop to control the size of the heading. The prop also provides correct line height and corrective letter spacing—as text size increases, the relative line height and letter spacing decrease.
Heading sizes match Text sizes. However, the line heights are set a bit tighter as headings tend to be shorter than running text.
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
Weight
Use the weight prop to set the text weight.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
Align
Use the align prop to set text alignment.
Left-aligned
Center-aligned
Right-aligned
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.
Without trim
With trim
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.
The quick brown fox jumps over the lazy dog
Wrap
Use the wrap prop to control text wrapping.
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
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.
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
High-contrast
Use the highContrast prop to increase color contrast with the background.