Use Heading for consistent page and section titles. The tag prop sets both the DOM element and the visual scale.
Setup
<script lang="ts">
import { Heading } from '.';
</script> Levels
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
<script lang="ts">
import { Heading } from '.';
</script>
<Heading tag="h1">Heading 1</Heading>
<Heading tag="h2">Heading 2</Heading>
<Heading tag="h3">Heading 3</Heading>
<Heading tag="h4">Heading 4</Heading>
<Heading tag="h5">Heading 5</Heading>
<Heading tag="h6">Heading 6</Heading> Custom class
Combine with utility classes for spacing or color overrides.
Primary accent title
<script lang="ts">
import { Heading } from '.';
</script>
<Heading tag="h3" class="text-primary-600">Primary accent title</Heading> Props
| Prop | Type | Default | Description |
|---|---|---|---|
tag | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'h1' | Semantic element and size token |
children | Snippet | — | Heading text / nested content |
class | ClassValue | — | Extra classes merged with theme |
...rest | HTMLAttributes<HTMLElement> | — | Passed to the rendered heading element |
Theme sizes (tag)
| Tag | Classes |
|---|---|
h1 | text-5xl font-extrabold |
h2 | text-4xl |
h3 | text-3xl |
h4 | text-2xl |
h5 | text-xl |
h6 | text-lg |
All levels share font-bold text-gray-900 dark:text-white from the theme base.