Site header
In code: SiteHeader
The header of a site or a public page: the brand, the main links and an action or two in one line. - It floats: at the top of the page it sits on the page; once the page scrolls it becomes a solid bar that stays. - Links to places on the page (#rooms) follow the reader: the one for the section in view is marked, and the mark slides from link to link. - When its box is too narrow (a phone), the links and actions fold into a menu behind a burger (<SiteMenu>): a floating panel with the links set large and numbered, rising in one after another, and a painted picture with the actions at its foot. A link to a place on the page closes the menu first, then scrolls there.
Preview
Use
import { Button, SiteHeader } from '@/components/ui';
<div className="ui-grow">
<SiteHeader
sticky={false}
brand="Harbour Studio"
items={LINKS}
actions={<Button variant="primary">Book</Button>}
/>
</div>Options
| Option | Type | What it does |
|---|---|---|
brand Needed | ReactNode | The site's name or logo at the start. A plain name is drawn as a <Logo> linking to brandHref; pass a <Logo> of your own for an icon mark or an image. |
items Needed | NavigationEntry[] | The site's main links, as for <NavigationMenu>: plain links, or groups of links. |
actions | ReactNode | At the end: a button or two ("Sign in", "Book a stay"). On a small screen they move into the menu. |
aria-label | string | Defines a string value that labels the current element. What the navigation is: "Main". |
brandHref | string · default '/' | Where a plain-name brand leads: "/" by default. |
link | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | The app's own link component, as for <NavigationMenu>. |
menuTitle | string | The menu's title on a small screen: the site's name (a plain-name brand by default). It also paints the picture at the foot of the menu. |
sticky | boolean · default true | Stays at the top while the page scrolls, as a floating bar. On by default; sticky={false} leaves it in place. |
It also takes the 278 attributes of the element or UI SDK part it draws: className, aria-label, events and the rest.
Without React
The same look on any HTML, with the classes header.ui-site-header > .ui-site-header-bar.
With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:
components/site-header.cssIn the examples
Small screens made with it and the rest of the kit. They work: click, type and choose in them.
A calendar that fills itself
Open the Product menu: a panel of links slides in under it. On a phone the links fold into a menu.
Showing things: states, do and don’t
The header of a public page or site, inside the page's Container (see The page): the brand (a plain name is drawn as a Logo), the main links (the same items as NavigationMenu) and one or two actions in one line. It floats: at the top of the page it sits on the page, and once the page scrolls it stays as a solid bar (sticky={false} leaves it in place). Links to places on the page (#rooms) follow the reader: the section in view is marked and the mark slides between links. When its box is narrower than 48rem it folds into a Burger that opens a floating menu: the links set large and numbered, rising in one after another, and a picture painted from menuTitle (the site's name) with the actions under it. A link to a place on the page closes the menu, then scrolls there. Use it rather than putting NavigationMenu in a Row yourself. SiteMenu is its phone menu alone (the two-line button and the panel it opens): for a bar of your own, put it at the bar's end and show it where the links do not fit. Never build another menu for a phone.
States. Lists, tables and boards have three more states besides their content: empty (Empty, with the first action inside), loading (Skeleton) and failed (Alert tone="danger"). A chosen row shows in ink, never in the brand colour.
Do
- Put numbers, dates and codes in
ui-mono(in a table cell,ui-num, which also aligns them). - Let a
Tableturn into blocks on a phone; give itscrollonly when it is read down its columns. - Show a status in words and colour together (
Badge tone="success"with "Paid"), never colour alone.
Don't
- Don't put a card round a
Table,List,Cells,CalendarorEmpty: they draw their own box. - Don't truncate a name or a price to fit; let it wrap. Truncate only file names and addresses.
- Don't use the status colours (success, warning, danger, info) for anything but those meanings.