Typography
Change fonts
You can change fonts and other text styles for headings, code and all other components with the following theme properties:
theme.fontFamily
– controls font-family in all components except Title, Code and Kbdtheme.fontFamilyMonospace
– controls font-family of components that require monospace font: Code, Kbd and CodeHighlighttheme.headings.fontFamily
– controls font-family of h1-h6 tags in Title and TypographyStylesProvider components, fallbacks totheme.fontFamily
if not defined
Greycliff CF title
Monaco, Courier Code
System fonts
By default, Mantine uses system fonts. It means that different devices will display components based on available font, for example, macOS and iOS users will see San Francisco font, Windows users will see Segoe UI font, Android users will see Roboto font and so on. This approach provides a familiar experience to the users and allows avoiding common problems related to custom fonts loading (layout shift, invisible text, etc.), if you do not have strict requirements, it is recommended to use system fonts for better performance.
Default values for theme properties:
- Default value for
theme.fontFamily
andtheme.headings.fontFamily
is-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji
- Default value for
theme.fontFamilyMonospace
isui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace
Font sizes
Paras is an orange, insectoid Pokémon that resembles the nymph stage of a cicada. Its ovoid body is segmented, and it has three pairs of legs. The foremost pair of legs is the largest and has sharp claws at the tips. There are five specks on its forehead and three teeth on either side of its mouth. It has circular eyes with large pseudopupils.
theme.fontSizes
property defines font-size values for all Mantine components:
Default theme.fontSizes
values:
Key | Value | Value in px |
---|---|---|
xs | 0.75rem | 12px |
sm | 0.875rem | 14px |
md | 1rem | 16px |
lg | 1.125rem | 18px |
xl | 1.25rem | 20px |
Line heights
theme.lineHeights
property defines line-height values for Text component,
most other components use theme.lineHeights.md
by default:
Default theme.lineHeights
values:
Key | Value |
---|---|
xs | 1.4 |
sm | 1.45 |
md | 1.55 |
lg | 1.6 |
xl | 1.65 |
h1-h6 styles
To customize headings styles in Title and TypographyStylesProvider components
set theme.headings
:
With theme.headings
you can customize font-size, font-weight and line-height per heading level.
If you need more control over styles, use :is selector
with Styles API to target specific heading level: