Skip to main contentCarbon Design System

Heading

Preview the Heading component with the React live demo. For detailed code usage documentation, see the Storybooks for each framework below.

Documentation

Live demo



      This live demo contains only a preview of functionality and styles available for this component. View the full demo on Storybook for additional information such as its version, controls, and API documentation.

      Code examples

      Installation

      npm install @carbon/react

      Basic implementation

      import { Heading, Section } from '@carbon/react';
      function MyPage() {
      return (
      <Section>
      <Heading>Main Title</Heading>
      <p>Page content...</p>
      <Section>

      Semantic HTML with
      as
      prop

      <Section as="article">
      <Heading>Article Title</Heading>
      <p>Article content...</p>
      </Section>
      <Section as="nav">
      <Heading>Navigation</Heading>
      <ul>...</ul>
      </Section>

      Manual level override

      // Start at h3 instead of h1
      <Section level={3}>
      <Heading>This renders as h3</Heading>
      <Section>
      <Heading>This renders as h4</Heading>
      </Section>
      </Section>

      Reusable component pattern

      function Card({ title, description, children }) {
      return (
      <Section className="card">
      <Heading>{title}</Heading>
      <p>{description}</p>
      {children}
      </Section>
      );
      }