Heading

A heading whose document level and visual size are set independently, using the theme type scale.

Status: stable. Category: Typography.

import { Heading } from '@glyphui/ui'

Exports: Heading, headingStyles.

Notes

  • level sets the h1–h6 element; size sets the look. Choose level for the document outline.
  • Headings use font-display and text-wrap: balance.

Heading props

PropTypeDefaultDescription
asChildboolean
levelLevelDocument outline level (h1–h6). Visual size follows it unless size is set.
size"h2" | "h3" | "h1" | "h4" | "display"

Example: Type scale

import { Heading } from '@glyphui/ui'

export default function Example() {
  return (
    <div className="grid gap-3">
      <Heading level={1} size="display">
        Ship the details
      </Heading>
      <Heading level={1}>Design is how it works</Heading>
      <Heading level={2}>Type sets the tone</Heading>
      <Heading level={3}>Cards, navbars and sidebars</Heading>
      <Heading level={4}>Section heading</Heading>
    </div>
  )
}

Example: Level and size

Keep the outline correct while choosing any visual size.

import { Heading, Text } from '@glyphui/ui'

export default function Example() {
  return (
    <div className="grid gap-2">
      <Heading level={2} size="h4">
        Billing
      </Heading>
      <Text size="small" tone="muted">
        An h2 in the outline, sized like an h4 for a dense settings page.
      </Text>
    </div>
  )
}

Live page: https://glyphui.xyz/components/heading