Heading
Semantic heading primitive with independent style scaling.
Installation$
Install from the package for shared ownership or from the registry for copy-paste control.
Package Manager$
pnpm add @glinui/ui @glinui/tokensRegistry$
pnpm dlx @glinui/cli@latest add headingUsage$
Heading renders the correct semantic <h1>–<h6> element determined by the level prop, while the size prop controls the visual font scale independently. This decouples document structure from visual hierarchy — a section subheading can use level={3} for correct outline order while appearing large with size="lg".
Basic$
Heading Level 1
Heading Level 2
Heading Level 3
1import { Heading } from "@glinui/ui"23export function HeadingBasicDemo() {4return (5 <div className="space-y-2">6 <Heading level={1}>Heading Level 1</Heading>7 <Heading level={2}>Heading Level 2</Heading>8 <Heading level={3}>Heading Level 3</Heading>9 </div>10)11}
Examples$
Variants$
The variant prop applies a surface treatment — useful when a heading needs to sit on a glass card or a transparent overlay.
Default Heading
Glass Heading
Outline Heading
Ghost Heading
1import { Heading } from "@glinui/ui"23export function HeadingVariantDemo() {4return (5 <div className="space-y-2">6 <Heading variant="default">Default Heading</Heading>7 <Heading variant="glass">Glass Heading</Heading>8 <Heading variant="outline">Outline Heading</Heading>9 <Heading variant="ghost">Ghost Heading</Heading>10 </div>11)12}
Sizes$
Small heading
Medium heading
Large heading
1import { Heading } from "@glinui/ui"23export function HeadingSizeDemo() {4return (5 <div className="space-y-2">6 <Heading size="sm">Small heading</Heading>7 <Heading size="md">Medium heading</Heading>8 <Heading size="lg">Large heading</Heading>9 </div>10)11}
Independent Level and Size$
The key feature of Heading is that semantic level and visual size are fully independent. An h3 can visually appear as large as a page title, and an h1 can be styled small for compact interfaces — all without breaking document outline order.
Large h3 — section title styled like a hero heading
Small h1 — compact page title
Default h4 subsection
1import { Heading } from "@glinui/ui"23export function HeadingIndependentDemo() {4return (5 <div className="space-y-4">6 {/* Visually large, semantically an h3 */}7 <Heading level={3} size="lg">8 Large h3 — section title styled like a hero heading9 </Heading>1011 {/* Visually small, semantically an h1 — e.g., page header in a compact layout */}12 <Heading level={1} size="sm">13 Small h1 — compact page title14 </Heading>1516 {/* h4 at default md size — standard subsection */}17 <Heading level={4} size="md">18 Default h4 subsection19 </Heading>20 </div>21)22}
Full Level Range$
h1 — Page title
h2 — Section
h3 — Subsection
h4 — Group
h5 — Detail
h6 — Caption-level
1import { Heading } from "@glinui/ui"23export function HeadingLevelsDemo() {4return (5 <div className="space-y-1">6 <Heading level={1}>h1 — Page title</Heading>7 <Heading level={2}>h2 — Section</Heading>8 <Heading level={3}>h3 — Subsection</Heading>9 <Heading level={4}>h4 — Group</Heading>10 <Heading level={5}>h5 — Detail</Heading>11 <Heading level={6}>h6 — Caption-level</Heading>12 </div>13)14}
Accessibility$
- Always use headings in a logical, non-skipping order (h1 → h2 → h3) to maintain a coherent document outline for screen readers.
- The
levelprop controls the rendered HTML tag — never override this with CSSdisplaytricks that break semantics. - Decoupling
levelfromsizelets you meet visual design requirements without compromising heading hierarchy. - Avoid using multiple
level={1}headings on a single page; pages should have exactly one<h1>.
Reduced Motion$
Heading is a static text primitive with no animation. No reduced-motion considerations apply.
API Reference$
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
level | HeadingLevel | No | 2 | Auto-generated from TypeScript source. |
size | "sm" | "md" | "lg" | No | "md" | Variant option from headingVariants. |
variant | "default" | "glass" | "outline" | "ghost" | No | "default" | Variant option from headingVariants. |
Source$
1import { Heading } from "@glinui/ui"
Generated API Snapshot
Beta
Generated API Snapshot
BetaAuto-extracted from TypeScript source in packages/ui/src/components/heading.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.
Generated: 2026-02-19T17:59:28.468Z · Full index: /docs/api-metadata
Primary Props Type
HeadingProps
HeadingProps
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
level | HeadingLevel | No | 2 | - |
size | "sm" | "md" | "lg" | No | "md" | Variant option from headingVariants. |
variant | "default" | "glass" | "outline" | "ghost" | No | "default" | Variant option from headingVariants. |