On this page
Heading
Renders a styled h2 heading by default. The h1 through h6 headings have different sizes. Use xstyle to override styles.
Overview
Copy the source into your project. Import the parts that you need. Styles use local StyleX declarations and shared theme tokens. You can change the source without a wrapper or replacement package.
Preview
Hierarchical page headings
Installation
Run the init command from your project root first. The CLI configures StyleX and installs shared files and dependencies.
Run from your project root. The CLI installs required components, shared files, and packages. Previews may need additional components. The CLI keeps existing files.
Usage
Heading renders h2 by default. It uses the heading font token and foreground color token. Default sizes are h1 2.25rem, h2 1.5rem, h3 1.25rem, h4 1.125rem, h5 1rem, and h6 0.875rem. Other defaults are weight 400, 1.25 line height, -0.02em letter spacing, and zero margins. Use render={<h1 />} through render={<h6 />} to select semantic levels. The Base UI render prop also supports callbacks and custom components. Sizes follow the rendered native heading tag, including callbacks and custom components. Other rendered tags use the h2 size. Use xstyle to override the size.
Import from the local file installed by the CLI.
API reference
The generator reads the component TypeScript source. Only component and Base UI props appear below. The Required column shows whether you must supply a property. It does not mean you must use the component.