SectionHeader
Project settings
Members
Pending invitations
Updated yesterday
When to use
- A block heading inside a page or card, next to a counter, a link, a period control or a small button.
- You need a real h2/h3/h4, not a styled div.
When not to use
- For the page's single
h1, usePageHeader. - For a modal header, use
ModalHeader. - Do not use
sizeto fix the logical heading hierarchy.
Minimal example
<SectionHeader title="Publication contents" level={2} right={<Button size="sm">Add</Button>} />Public API
title is required and can be a ReactNode. right takes a ready-made ReactNode
for an action/status. size is sm or md (the default): it is only the font size.
level is 2 | 3 | 4, 3 by default; it determines the actual HTML heading.
The component also accepts native div props and a ref; the div title prop is excluded.
Accessibility and keyboard
Choose level based on the previous heading: right after PageHeader (h1) you usually
need level={2}; the default, h3, fits a section nested in another section.
Do not change the level to get smaller text: use size. right has no
special keyboard handling — nested controls must be accessible on their own.
See the SectionHeader source.
Good examples
level={2}underPageHeader, thenlevel={3}in a card.rightwith a link, a smallButtonor neutral metadata.titlewith an icon and text as a ReactNode without a nested heading.
Anti-patterns
- Leaving an h3 right under the h1 only because it is the default.
- Nesting an
<h2>intitleand getting a heading inside a heading. - Using
SectionHeaderas a page-level layout component.
Related sources and Storybook
src/components/navigation/SectionHeader.tsxsrc/components/navigation/SectionHeader.stories.tsx
TypeScript types
SectionHeaderProps
Prop
Type
Plus DOM attributes, such as onChange, onClick, className — 278 in total; the table does not repeat them.
PageHeaderProps
Prop
Type
Plus DOM attributes, such as onChange, onClick, className — 278 in total; the table does not repeat them.