Skip to main content
Styles

Caption

Sometimes you may need to make it clear that a page is part of a larger section or group. To do this, you can use a heading with a caption above it.

Read the Design System guidance for caption

Import

import { Caption } from 'govuk-react/caption';

Examples

Default

Code
<Caption size="xl">
  Heading text
</Caption>

Placed with a heading component

Code
<>
  <Caption {...args} />
  <Heading size="xl" headingLevel={1}>
    Main heading text
  </Heading>
</>

Placed inside a heading component

Code
<Heading size="xl" headingLevel={1}>
  <Caption {...args} />
  Main heading text
</Heading>

Showing all standard caption sizes with headings

Code
<>
  <Caption {...args} />
  <Heading size="xl" headingLevel={1}>
    Main heading size xl
  </Heading>
  <Caption size="l">Supporting heading size l</Caption>
  <Heading size="l">Main heading size l</Heading>
  <Caption size="m">Supporting heading size m</Caption>
  <Heading size="m" headingLevel={3}>
    Main heading size m
  </Heading>
</>

API reference

Caption

Sometimes you may need to make it clear that a page is part of a larger section or group. To do this, you can use a heading with a caption above it.

PropType
sizeRequired"xl" | "l" | "m"