File: heading.md | Updated: 11/15/2025
ThemesThemes PrimitivesPrimitives IconsIcons ColorsColors
Getting started Styling Layout Releases Resources
Overview Color Dark mode Typography Spacing Breakpoints Radius Shadows Cursors
Box Flex Grid Container Section
Text Heading Blockquote Code Em Kbd Link Quote Strong
Alert Dialog Aspect Ratio Avatar Badge Button Callout Card Checkbox Checkbox Group Checkbox Cards Context Menu Data List Dialog Dropdown Menu Hover Card Icon Button Inset Popover Progress Radio Radio Group Radio Cards Scroll Area Segmented Control Select Separator Skeleton Slider Spinner Switch Table Tabs Tab Nav Text Area Text Field Tooltip
Accessible Icon Portal Reset Slot Theme Visually Hidden
Components
Semantic heading element.
View source Report an issue View in Playground
<Heading>The quick brown fox jumps over the lazy dog</Heading>
This component is based on the h1 element and supports common margin props
.
| Prop | Type | Default |
| --- | --- | --- |
| as<br><br>Prop description | "h1" \| "h2" \| "h3" \| "h4" \| "h5" \| "h6" | "h1" |
| asChild<br><br>Prop description | boolean | No default value |
| size | Responsive<enum><br><br>See full type | "6" |
| weight | Responsive<"light" \| "regular" \| "medium" \| "bold"> | No default value |
| align<br><br>Prop description | Responsive<"left" \| "center" \| "right"> | No default value |
| trim<br><br>Prop description | Responsive<"normal" \| "start" \| "end" \| "both"> | No default value |
| truncate<br><br>Prop description | boolean | No default value |
| wrap<br><br>Prop description | Responsive<"wrap" \| "nowrap" \| "pretty" \| "balance"> | No default value |
| color<br><br>Prop description | enum<br><br>See full type | No default value |
| highContrast<br><br>Prop description | boolean | No default value |
Use the as prop to change the heading level. This prop is purely semantic and does not change the visual appearance.
<Heading as="h1">Level 1</Heading>
<Heading as="h2">Level 2</Heading>
<Heading as="h3">Level 3</Heading>
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.
<Flex direction="column" gap="3">
<Heading size="1">The quick brown fox jumps over the lazy dog</Heading>
<Heading size="2">The quick brown fox jumps over the lazy dog</Heading>
<Heading size="3">The quick brown fox jumps over the lazy dog</Heading>
<Heading size="4">The quick brown fox jumps over the lazy dog</Heading>
<Heading size="5">The quick brown fox jumps over the lazy dog</Heading>
<Heading size="6">The quick brown fox jumps over the lazy dog</Heading>
<Heading size="7">The quick brown fox jumps over the lazy dog</Heading>
<Heading size="8">The quick brown fox jumps over the lazy dog</Heading>
<Heading size="9">The quick brown fox jumps over the lazy dog</Heading>
</Flex>
Use the weight prop to set the text weight.
<Heading weight="regular">
The quick brown fox jumps over the lazy dog.
</Heading>
<Heading weight="medium">
The quick brown fox jumps over the lazy dog.
</Heading>
<Heading weight="bold">
The quick brown fox jumps over the lazy dog.
</Heading>
Use the align prop to set text alignment.
<Heading align="left">Left-aligned</Heading>
<Heading align="center">Center-aligned</Heading>
<Heading align="right">Right-aligned</Heading>
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.
<Flex direction="column" gap="3">
<Heading
trim="normal"
style={{
background: "var(--gray-a2)",
borderTop: "1px dashed var(--gray-a7)",
borderBottom: "1px dashed var(--gray-a7)",
}}
>
Without trim
</Heading>
<Heading
trim="both"
style={{
background: "var(--gray-a2)",
borderTop: "1px dashed var(--gray-a7)",
borderBottom: "1px dashed var(--gray-a7)",
}}
>
With trim
</Heading>
</Flex>
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.
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 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.
<Flex direction="column" gap="3">
<Box
style={{
background: "var(--gray-a2)",
border: "1px dashed var(--gray-a7)",
}}
p="4"
>
<Heading mb="1" size="3">
Without trim
</Heading>
<Text>
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.
</Text>
</Box>
<Box
p="4"
style={{
background: "var(--gray-a2)",
border: "1px dashed var(--gray-a7)",
}}
>
<Heading mb="1" size="3" trim="start">
With trim
</Heading>
<Text trim="end">
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.
</Text>
</Box>
</Flex>
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.
.radix-themes {
--default-leading-trim-start: 0.42em;
--default-leading-trim-end: 0.36em;
--heading-leading-trim-start: 0.42em;
--heading-leading-trim-end: 0.36em;
}
Use the truncate prop to truncate text with an ellipsis when it overflows its container.
<Flex maxWidth="300px">
<Heading truncate>The quick brown fox jumps over the lazy dog</Heading>
</Flex>
Use the wrap prop to control text wrapping.
<Flex maxWidth="300px">
<Heading wrap="nowrap">The quick brown fox jumps over the lazy dog</Heading>
</Flex>
<Flex maxWidth="300px">
<Heading wrap="balance">The quick brown fox jumps over the lazy dog</Heading>
</Flex>
<Flex maxWidth="300px">
<Heading wrap="pretty">The quick brown fox jumps over the lazy dog</Heading>
</Flex>
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.
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.
<Flex direction="column">
<Heading color="indigo">The quick brown fox jumps over the lazy dog</Heading>
<Heading color="cyan">The quick brown fox jumps over the lazy dog</Heading>
<Heading color="orange">The quick brown fox jumps over the lazy dog</Heading>
<Heading color="crimson">The quick brown fox jumps over the lazy dog</Heading>
</Flex>
Use the highContrast prop to increase color contrast with the background.
<Flex direction="column">
<Heading color="gray">The quick brown fox jumps over the lazy dog.</Heading>
<Heading color="gray" highContrast>
The quick brown fox jumps over the lazy dog.
</Heading>
</Flex>
PreviousText
NextBlockquote