Title

h1-h6 heading

Import

Usage

Use Title component to render h1-h6 headings with Mantine theme styles. By default, Title has no margins and paddings. You can change font-size, font-weight and line-height per heading with theme.headings.

Set order prop to render a specific element (h1-h6), default order is 1:

This is h1 title

This is h2 title

This is h3 title

This is h4 title

This is h5 title
This is h6 title
import { Title } from '@mantine/core';

function Demo() {
  return (
    <>
      <Title order={1}>This is h1 title</Title>
      <Title order={2}>This is h2 title</Title>
      <Title order={3}>This is h3 title</Title>
      <Title order={4}>This is h4 title</Title>
      <Title order={5}>This is h5 title</Title>
      <Title order={6}>This is h6 title</Title>
    </>
  );
}

Size

You can change Title size independent of its order:

  • If you set size to h1-h6, then component will add corresponding font-size and line-height from the theme
  • If you set size to any other value, then line-height will be calculated based on ordersize will impact only font-size

H3 heading with h1 font-size

H1 heading with h4 font-size

H1 heading with calc(0.75rem * var(--mantine-scale)) size

import { Title } from '@mantine/core';

function Demo() {
  return (
    <>
      <Title order={3} size="h1">
        H3 heading with h1 font-size
      </Title>
      <Title size="h4">H1 heading with h4 font-size</Title>
      <Title size="calc(0.75rem * var(--mantine-scale))">H1 heading with calc(0.75rem * var(--mantine-scale)) size</Title>
    </>
  );
}