GitHub

Heading

Semantic heading component with size variants

Installation

pnpm add @corew500/ui

Usage

import { Heading } from "@corew500/ui/heading"

<Heading>Content</Heading>

Variants

headingVariants

AxisValuesDefault
size
4xl3xl2xlxllgbase
2xl
intent
defaultmuteddestructive
default
align
leftcenterright
none

CMS Integration

CMSPayload CMS Integration
This component supports CMS-driven content via @corew500/cms-payload.
Loading...

API Reference

Props

PropTypeDefaultDescription
level*enumThe semantic heading level (1-6). Determines HTML element and default visual size. - Level 1 renders `<h1>` with size 4xl (page titles) - Level 2 renders `<h2>` with size 3xl (section headings) - Level 3 renders `<h3>` with size 2xl (subsection headings) - Level 4 renders `<h4>` with size xl (card titles, group headings) - Level 5 renders `<h5>` with size lg (minor headings) - Level 6 renders `<h6>` with size base (small headings, overlines)
sizeenumDerived from level (level 1 = "4xl", level 2 = "3xl", etc.)Override the visual size while keeping semantic level. Useful for visually demoting a heading without breaking document structure.
intentenum"default"Color intent for the heading. - `default`: Standard foreground color - `muted`: Subdued muted-foreground color - `destructive`: Destructive/error color
alignenumText alignment. - `left`: Left-aligned text - `center`: Center-aligned text - `right`: Right-aligned text

Accessibility

Focus Management

  • Maintains document outline structure for screen readers

Additional

  • - Renders proper semantic HTML elements (h1-h6) based on level
  • Use levels sequentially (h1 -> h2 -> h3) for proper heading hierarchy
  • Avoid skipping heading levels (e.g., h1 directly to h3)
  • Each page should have exactly one h1

Localization

Translatable Content

  • - Pass pre-translated strings as children

Additional

  • Component does not contain internal i18n logic