Usage
Extra small text
Small text
Default text
Large text
Extra large text
Semibold
Bold
Italic
Underlined
Strikethrough
Dimmed text
Blue text
Teal 4 text
Uppercase
capitalized text
Aligned to center
Aligned to right
Gradient variant
When variant
prop is set to gradient
, you can control gradient with gradient
prop, it accepts an object with from
, to
and deg
properties. If thegradient
prop is not set, Text
will use theme.defaultGradient
which can be configured on the theme object. gradient
prop is ignored when variant
is not gradient
.
Note that variant="gradient"
supports only linear gradients with two colors. If you need a more complex gradient, then use Styles API to modify Text
styles.
Gradient Text
Truncate
Set truncate
prop to add text-overflow: ellipsis
styles:
Lorem ipsum dolor sit amet consectetur adipisicing elit. Unde provident eos fugiat id necessitatibus magni ducimus molestias. Placeat, consequatur. Quisquam, quae magnam perspiciatis excepturi iste sint itaque sunt laborum. Nihil?
Line clamp
Specify maximum number of lines with lineClamp
prop. This option uses -webkit-line-clamp
CSS property (caniuse). Note that padding-bottom
cannot be set on text element:
From Bulbapedia: Bulbasaur is a small, quadrupedal Pokémon that has blue-green skin with darker patches. It has red eyes with white pupils, pointed, ear-like structures on top of its head, and a short, blunt snout with a wide mouth. A pair of small, pointed teeth are visible in the upper jaw when its mouth is open. Each of its thick legs ends with three sharp claws. On Bulbasaur's back is a green plant bulb, which is grown from a seed planted there at birth. The bulb also conceals two slender, tentacle-like vines and provides it with energy through photosynthesis as well as from the nutrient-rich seeds contained within.
Line clamp can also be used with any children (not only strings), for example with TypographyStylesProvider:
Line clamp with TypographyStylesProvider
Lorem ipsum dolor sit amet consectetur adipisicing elit. Nesciunt nulla quam aut sed corporis voluptates praesentium inventore, sapiente ex tempore sit consequatur debitis non! Illo cum ipsa reiciendis quidem facere, deserunt eos totam impedit. Vel ab, ipsum veniam aperiam odit molestiae incidunt minus, sint eos iusto earum quaerat vitae perspiciatis.
Inherit styles
Text always applies font-size, font-family and line-height styles,
but in some cases this is not a desired behavior. To force Text to inherit parent
styles set inherit
prop. For example, highlight part of Title:
Title in which you want to highlight something
Polymorphic component
Text
is a polymorphic component – its default root element is p
, but it can be changed to any other element or component with component
prop:
Polymorphic components with TypeScript
Note that polymorphic components props types are different from regular components – they do not extend HTML element props of the default element. For example,
TextProps
does not extendReact.ComponentPropsWithoutRef'<'div'>'
althoughp
is the default element.If you want to create a wrapper for a polymorphic component that is not polymorphic (does not support
component
prop), then your component props interface should extend HTML element props, for example:If you want your component to remain polymorphic after wrapping, use
createPolymorphicComponent
function described in this guide.
span prop
Use span
prop as a shorthand for component="span"
:
Text Style API
Thinker Mantine provides a comprehensive set of typography utility classes that can be applied using the ts
(text style) prop on any component. These classes provide consistent typography across your application with predefined font sizes, line heights, font weights, and text decorations.
Available Categories
The text style utility classes are organized into several categories, each serving different typography purposes:
- Display: Large, bold text for headings and titles
- Heading: Subtle, semi-bold text for section headings
- Title: Medium-sized, semi-bold text for card titles and secondary headings
- Body: Normal-weight text for main content
- Body Highlight: Semi-bold text for highlighted content
- Paragraph: Smaller, normal-weight text for paragraphs
- Paragraph Highlight: Semi-bold text for highlighted paragraphs
- Label: Small, normal-weight text for labels
- Link Underline: Underlined text for links (note: this is not a link component, it's just a text style class that can be used on any text element)
Usage
Apply text style classes using the ts
prop on any Mantine component:
Font Size Scale
Each category follows a consistent font size scale from 1-10
Consistent Properties
All text style classes include:
- Line Height: 1.5 (consistent across all classes)
- Font Weight: Category-specific (400, 600, or 700)
- Text Decoration: Category-specific (none or underline)
Examples
Display Classes (Bold, Weight 700)
Display 1 - 56px
Display 2 - 48px
Display 3 - 40px
Display 5 - 32px
Display 7 - 24px
Display 9 - 16px
Heading Classes (Semi-bold, Weight 600)
Heading 2 - 40px
Heading 4 - 32px
Heading 5 - 28px
Heading 6 - 24px
Heading 8 - 16px
Heading 10 - 12px
Title Classes (Semi-bold, Weight 600)
Title 2 - 32px
Title 3 - 28px
Title 5 - 22px
Title 7 - 18px
Title 8 - 16px
Title 9 - 14px
Body Classes (Normal, Weight 400)
Body 1 - 24px
Body 2 - 22px
Body 4 - 18px
Body 5 - 16px
Body 6 - 14px
Body 7 - 12px
Body Highlight Classes (Semi-bold, Weight 600)
Body Highlight 1 - 24px
Body Highlight 2 - 22px
Body Highlight 4 - 18px
Body Highlight 5 - 16px
Body Highlight 6 - 14px
Body Highlight 7 - 12px
Paragraph Classes (Normal, Weight 400)
Paragraph 2 - 20px
Paragraph 3 - 18px
Paragraph 4 - 16px
Paragraph 5 - 14px
Paragraph 6 - 12px
Paragraph 7 - 10px
Paragraph 8 - 8px
Paragraph Highlight Classes (Semi-bold, Weight 600)
Paragraph Highlight 2 - 20px
Paragraph Highlight 3 - 18px
Paragraph Highlight 4 - 16px
Paragraph Highlight 5 - 14px
Paragraph Highlight 6 - 12px
Paragraph Highlight 7 - 10px
Paragraph Highlight 8 - 8px
Label Classes (Normal, Weight 400)
Label 1 - 24px
Label 2 - 22px
Label 4 - 18px
Label 5 - 16px
Label 6 - 14px
Label 7 - 12px
Link Underline Classes (Normal, Weight 400, Underlined)
Link Underline 1 - 24px
Link Underline 2 - 22px
Link Underline 4 - 18px
Link Underline 5 - 16px
Link Underline 6 - 14px
Link Underline 7 - 12px