Heading

A semantic heading with an independent visual size.

Project settings

Manage your project and its members.
import { Heading } from "@/components/ui/heading"
import { Text } from "@/components/ui/text"
import { VStack } from "@/components/ui/stack"

export default function HeadingDemo() {
  return (
    <VStack gap={3}>
      <Heading>Project settings</Heading>
      <Text tone="muted">Manage your project and its members.</Text>
    </VStack>
  )
}

Installation

pnpm dlx shadcn@latest add @arene/heading

Needs the arene setup first. Also adds Text.

Usage

import { Heading } from "@/components/ui/heading"
<Heading level={1}>Account settings</Heading>

level selects h1 through h6 and sets the default size. size overrides it with sm, base, lg, xl2, xl3 or xl4 from Text, and does not change the heading level. headingStyles exports base, sizes and weights.

Level

Choose the level for the document outline. Each level has a default size: h1 is xl2, h2 is lg, h3 is base, and h4 through h6 are sm.

Level 1

Level 2

Level 3

Level 4

Level 5
Level 6
import { Heading } from "@/components/ui/heading"
import { VStack } from "@/components/ui/stack"

export default function HeadingLevel() {
  return (
    <VStack gap={3}>
      <Heading level={1}>Level 1</Heading>
      <Heading level={2}>Level 2</Heading>
      <Heading level={3}>Level 3</Heading>
      <Heading level={4}>Level 4</Heading>
      <Heading level={5}>Level 5</Heading>
      <Heading level={6}>Level 6</Heading>
    </VStack>
  )
}

Size

Set size when a heading should look different from its level's default, such as an h2 card title at sm or an h1 display heading at xl4.

Contact details

Notifications

Team members

Project settings

Account overview

Build with arene

import { Heading } from "@/components/ui/heading"
import { VStack } from "@/components/ui/stack"

export default function HeadingSize() {
  return (
    <VStack gap={3}>
      <Heading size="sm">Contact details</Heading>
      <Heading size="base">Notifications</Heading>
      <Heading size="lg">Team members</Heading>
      <Heading size="xl2">Project settings</Heading>
      <Heading size="xl3">Account overview</Heading>
      <Heading size="xl4">Build with arene</Heading>
    </VStack>
  )
}

Weight

Headings default to semibold and inherit the surrounding color.

Normal heading

Medium heading

Semibold heading

Bold heading

import { Heading } from "@/components/ui/heading"
import { VStack } from "@/components/ui/stack"

export default function HeadingWeight() {
  return (
    <VStack gap={3}>
      <Heading weight="normal">Normal heading</Heading>
      <Heading weight="medium">Medium heading</Heading>
      <Heading weight="semibold">Semibold heading</Heading>
      <Heading weight="bold">Bold heading</Heading>
    </VStack>
  )
}

Composition

Pass render to choose a semantic element. Put its props on that element.

Team members

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

export default function HeadingRender() {
  return <Heading render={<h3 id="team">Team members</h3>} />
}

API reference

See Base UI's useRender reference for composition props. Native element props are forwarded.

PropTypeDefault
level1 | 2 | 3 | 4 | 5 | 62
sizekeyof typeof headingStyles.sizesFrom level
weightkeyof typeof headingStyles.weights"semibold"
renderuseRender.RenderPropNative element
xstyleStyleXStylesNone
classNamestringNone
styleCSSPropertiesNone

Data attributes

AttributeOnEffect
data-slot="heading"rootIdentifies the component
data-sizerootThe size in effect