Header

The bar across the top: brand, links and actions. Links fold into a menu when it is narrow.

import { Button, Header } from '@brand-studio/ui';

export default function HeaderDemo() {
  return (
    <div style={{ width: '100%' }}>
      <Header
        brand={<a href="#">Still</a>}
        items={[
          { label: 'Coffee', href: '#coffee', current: true },
          { label: 'Subscriptions', href: '#subscriptions' },
          { label: 'Brew guides', href: '#guides' },
        ]}
        actions={<Button>Subscribe</Button>}
      />
    </div>
  );
}

Installation

pnpm add @brand-studio/ui

Usage

import { Header } from '@brand-studio/ui';
<Header
  brand={<a href="/">Still</a>}
  items={[
    { label: 'Coffee', href: '/coffee', current: true },
    { label: 'Subscriptions', href: '/subscriptions' },
  ]}
  actions={<Button>Subscribe</Button>}
/>

Accessibility

  • Renders a <header> with a labelled <nav>. The current link gets aria-current="page".
  • The header measures its own width. Below 40rem the links hide and a Mobile Navigation button takes their place, so it works in a narrow column as well as a narrow screen.
  • Link and button targets are at least 40px tall.

API Reference

PropTypeDefault
brandReact.ReactNode
items?NavLink[]
actions?React.ReactNode
label?string'Main'
className?string''

Still, Deskhand and Hollis are fictional brands. The coffee photographs are original generated artwork. @brand-studio/ui is MIT licensed.