Headings
Heading components that mirror HTML equivalents
Heading components map semantic HTML headings to your configured font sizes on web and native.
Features
One size prop for all styles
Custom fonts with per-size styles
Installation
Headings is already installed in tamagui, or you can install it independently:
yarn
npm
bun
pnpm
The headings all extend from the base Heading component. This is our own theme for Inter headings; you can restyle them for any font.
Tamagui expects your font.size tokens to include the keys 1-10 so headings resolve automatically.
How it works
The Heading component is defined as follows:
Note that Heading, and H1-H6 all default to the heading font family that must be defined in your tamagui.config.ts.
Because Paragraph extends SizableText, you get automatic styles based on your font theme. Let’s see how SizableText defines the size variant, roughly, which gives a good idea of how Tamagui works, and how you could create or change your own headings at a lower level.
API reference
Heading
Headings extend SizableText props inheriting all the Tamagui standard props.