Header

Updated: Sep 24, 2026
Header shows the identity of the current route: a short text, an optional short metadata value, and at most one leading accessory — an icon, an avatar, or a loading indicator. It is display only; nothing in it is focusable or clickable.
Configure Header through the header* props on Page. Page creates the header and owns its placement, stacking, and relationship to the content below; applications do not render it directly. The props on this page map to the corresponding Page props one for one. For a heading that labels content inside a larger container-owned region, use ContainerHeader instead.

Usage

import { HeaderAvatarSize, Page } from '@wearables-ui-toolkit/mrbd';

export function ProfileRoute() {
  return (
    <Page
      headerText="Profile"
      headerMetadata="Online"
      headerShowAvatar
      headerAvatarSrc={profileImageUrl}
      headerAvatarAlt="Alex Chen"
      headerAvatarSize={HeaderAvatarSize.LARGE}
    >
      <ProfileContent />
    </Page>
  );
}
A text-only header, with the loading state driven by data:
<Page headerText="Messages" headerIsLoading={isSyncing}>
  <MessageList />
</Page>
An icon-led header, with a status indicator riding on the avatar of an identity route:
import { Page, StatusIndicatorType } from '@wearables-ui-toolkit/mrbd';

<Page headerText="Alerts" headerIcon={bellIcon}>
  <AlertList />
</Page>;

<Page
  headerText="Alex Chen"
  headerShowAvatar
  headerAvatarSrc={profileImageUrl}
  headerAvatarAlt="Alex Chen"
  headerStatusIndicator={StatusIndicatorType.ACTIVE}
>
  <ProfileContent />
</Page>;
Header, HeaderAvatarSize, and the HeaderProps / HeaderHandle types are all exported from the package root.

Props

The full prop type is HeaderProps.
PropTypeDefaultDescription
text
string
—
Header text.
maxLines
number
1
Maximum number of text lines.
metadata
string
—
Short supporting value shown next to the text.
icon
IconSource
—
Leading icon. Shown only when no avatar and no loading state are active.
showAvatar
boolean
false
Forces the avatar into the leading slot. Any avatar image or content prop also turns the avatar on.
avatarSrc
string
—
Image URL for the avatar’s primary slot.
avatarPrimaryContent
ReactNode
—
Content for the avatar’s primary slot. The avatar owns the slot size.
avatarSecondarySrc
string
—
Image URL for the avatar’s secondary slot in the duo layout.
avatarSecondaryContent
ReactNode
—
Content for the avatar’s secondary slot. The avatar owns the slot size.
avatarBadgeSrc
string
—
Image URL for the avatar’s image-badge slot.
avatarBadgeContent
ReactNode
—
Content for the avatar’s image-badge slot. The avatar owns the badge size.
avatarAlt
string
—
Alternative text for the avatar image. Header supplies no default, so an omitted value falls through to the avatar’s own English fallback label. Pass a localized string.
avatarSize
HeaderAvatarSize
HeaderAvatarSize.SMALL
Avatar size.
statusIndicator
StatusIndicatorType
—
Status indicator shown on the avatar.
statusIndicatorIcon
IconSource
—
Glyph drawn over the status-indicator dot. Only shows when statusIndicator is also set.
primaryImageShape
AvatarShape
—
Shape of the avatar’s primary image.
placeholderStyle
PlaceholderStyle
—
Placeholder treatment used by the avatar when it has no image or content.
isLoading
boolean
false
Whether an indeterminate loader takes the leading slot. Wins over both the icon and the avatar.
className
string
''
Class added to the header root alongside the component’s own class.
style
CSSProperties
{}
Inline styles applied to the header root.
aria-label
string
Text and metadata
Seeds the accessible name in place of the text and metadata.
HeaderProps is a closed interface: it does not spread arbitrary DOM attributes onto the root, and it has no children. Everything the header shows comes from the props above.

Types and enums

HeaderAvatarSize

MemberDescription
SMALL
Compact avatar for a dense header. The default.
LARGE
Prominent avatar for an identity-led header.
StatusIndicatorType, AvatarShape, and PlaceholderStyle come from Avatar. IconSource is the shared icon contract; see Icons.

Imperative handle

Header forwards a HeaderHandle. The ref is the handle, not the DOM node.
MethodReturnsDescription
getHeaderHeight()
number
Measured header height in pixels, 0 before layout.
getElement()
HTMLDivElement or null
The header root element, or null before mount.
Routes that need the header height should use the handle on Page, which reports 0 when the header is hidden.

Behavior

  • Declarative accessory swaps. Change showAvatar, avatarSrc, icon, isLoading, or avatarSize and the component animates between accessory states itself — the outgoing accessory scales and fades out, the incoming one scales and fades in, and the header animates the width change that follows. There is nothing imperative to call. When the user prefers reduced motion the width change is skipped and the header snaps to its new size.
  • One leading slot. The icon, the avatar, and the loading indicator share a single slot with a fixed precedence: the loader when isLoading is set, otherwise the avatar when showAvatar or any avatar image or content prop is set, otherwise icon. Passing an icon alongside avatar content silently shows the avatar.
  • Content anatomy. The text, metadata, and accessory are laid out with the emphasized chip anatomy, so they keep the same rhythm as a Chip.
  • Intrinsic sizing. The header wraps its content and never exceeds the width it is given. Preserve that intrinsic sizing rather than forcing a width or height.
  • Text overflow.maxLines caps the text: at the default of one line the text never wraps and is clipped by the header bounds, and higher values clamp to that many lines. The cap is a safety net, not extra room for a long title.
  • Material. The header root itself paints nothing. The chip anatomy inside supplies the surface background and its rounded shape, and that shape takes a larger corner radius when the avatar is rendered at HeaderAvatarSize.LARGE.
  • Rendering. The component is memoized, so a route that keeps its header props stable will not re-render the header as content changes.

Accessibility

  • The root reports role="heading" at level 1, so assistive technology can jump to the route identity. The level is fixed and cannot be changed through props.
  • Its accessible name is composed from the text and the metadata, joined with a comma. Passing aria-label replaces that composed pair.
  • When showAvatar is explicitly set and statusIndicator is present, the indicator’s description is appended to the accessible name — including when you supplied your own aria-label. Write labels that read correctly with that suffix. An avatar that is only inferred from avatarSrc or the other avatar content props still renders, but its status is not appended, so set showAvatar when the status has to be announced.
  • The name is omitted entirely when there is no text, no metadata, no aria-label, and no announced status.
  • Supply avatarAlt whenever an avatar is shown. Header adds no default of its own, so an omitted value falls through to the avatar’s built-in English fallback label.
  • The header supplies no interactive semantics. There is nothing to focus, so it can never be the only reachable element on a route.
  • Configure the header through Page so page layout remains coordinated.
  • Keep both text and metadata to at most two words.
  • Treat metadata as an optional qualifier and include it only when it adds high-value context.
  • Supply avatarAlt whenever an avatar is shown.
  • Use isLoading for in-flight route data instead of swapping in a separate spinner.

Avoid

  • Use ContainerHeader for a content section; Header is reserved for the page-level route identity.
  • Keep metadata to one useful qualifier instead of joining multiple facts with separators.
  • Shorten the title rather than using maxLines as overflow space.
  • Keep the header non-interactive. Wrapping it in a focusable element gives a heading ambiguous click semantics.
  • Choose icon or avatar content; when both are passed, the avatar wins.
  • Header internals are not a supported customization surface. Use ContainerHeader or Chip for a different heading treatment.