Skip to content
Ginga UI
Ginga UI
日本語

Getting started

  • Overview
  • Quick start
  • Theme generation
  • Custom rendering
  • All components

Forms

  • Button
  • Checkbox
  • Input
  • Radio
  • Questionnaire
  • SegmentedControl
  • Select
  • ComboBox
  • NumberField
  • SearchField
  • Slider
  • Switch
  • FormControl

Display

  • Accordion
  • Alert
  • AlertDialog
  • Badge
  • CodeBlock
  • Card
  • Dialog
  • Drawer
  • Image
  • List
  • Popover
  • Menu
  • Tooltip
  • Table
  • Tab
  • Toast
  • Trace

Typography

  • Heading
  • Paragraph

Navigation

  • Anchor

Layout

  • Box

Resources

  • Changelog
  • GitHub (opens in a new tab)

Logo: Twemoji (opens in a new tab) (CC-BY 4.0)

Heading

A heading component. Supports levels h1 through h6.

View in Storybook (opens in a new tab)

Installation

import { Heading } from "@ginga-ui/core";

Basic usage

A simple heading example.

Heading 1

Heading 2

Heading 3

heading.tsx
heading.module.css
import { Heading } from "@ginga-ui/core";
import styles from "./heading.module.css";

export function BasicExample() {
  return (
    <div className={styles.basicStack}>
      <Heading level={1}>Heading 1</Heading>
      <Heading level={2}>Heading 2</Heading>
      <Heading level={3}>Heading 3</Heading>
    </div>
  );
}

All levels

Shows headings at every level from h1 to h6.

Heading level 1

Heading level 2

Heading level 3

Heading level 4

Heading level 5
Heading level 6
heading.tsx
heading.module.css
import { Heading } from "@ginga-ui/core";
import styles from "./heading.module.css";

export function AllLevelsExample() {
  return (
    <div className={styles.allLevelsStack}>
      <Heading level={1}>Heading level 1</Heading>
      <Heading level={2}>Heading level 2</Heading>
      <Heading level={3}>Heading level 3</Heading>
      <Heading level={4}>Heading level 4</Heading>
      <Heading level={5}>Heading level 5</Heading>
      <Heading level={6}>Heading level 6</Heading>
    </div>
  );
}

Page structure

An example of a page structure with a proper heading hierarchy.

Article title

This is the introduction of the article.

Chapter 1

Content of chapter 1.

1.1 Subsection

Content of the subsection.

Chapter 2

Content of chapter 2.

heading.tsx
heading.module.css
import { Heading } from "@ginga-ui/core";
import styles from "./heading.module.css";

export function PageStructureExample() {
  return (
    <article className={styles.article}>
      <Heading level={1}>Article title</Heading>
      <p>This is the introduction of the article.</p>

      <Heading level={2}>Chapter 1</Heading>
      <p>Content of chapter 1.</p>

      <Heading level={3}>1.1 Subsection</Heading>
      <p>Content of the subsection.</p>

      <Heading level={2}>Chapter 2</Heading>
      <p>Content of chapter 2.</p>
    </article>
  );
}

Props

Heading

NameTypeDefaultDescription
level1 | 2 | 3 | 4 | 5 | 6-Required. Heading level. Renders the h1 to h6 element.
render(props) => ReactElement-Replaces the root element. Return an element that receives the given props, such as next/link.

Also accepts the attributes of the HTML h1-h6 (opens in a new tab) element.