Site page
In code: SitePage
One page of a site: the header, the page and the footer in the page column, with the room around them settled once. The header sits close above the page (a group's gap), the sections are a section apart, and the footer is a section below the last one, with a little room above the header and below the footer.
Preview
Rooms to rent by the hour
Two quiet rooms by the water, booked online
Prices
From £18 an hour, the room and the tea included
Use
import { Button, SiteHeader, SitePage } from '@/components/ui';
function SitePageDemo() {
return (
<SitePage
header={
<SiteHeader
brand="Harbour Studio"
sticky={false}
items={[
{ label: 'Rooms', href: '#rooms' },
{ label: 'Prices', href: '#prices' },
]}
actions={
<Button variant="primary" size="sm">
Book
</Button>
}
/>
}
footer={<span className="ui-small ui-muted">Harbour Studio · 4 Quay Street, Bristol</span>}
>
<section className="ui-stack ui-gap-2">
<h3 className="ui-title">Rooms to rent by the hour</h3>
<p className="ui-muted">Two quiet rooms by the water, booked online</p>
</section>
<section className="ui-stack ui-gap-2">
<h3 className="ui-heading">Prices</h3>
<p className="ui-muted">From £18 an hour, the room and the tea included</p>
</section>
</SitePage>
);
}Options
| Option | Type | What it does |
|---|---|---|
children Needed | ReactNode | The page's sections, each a direct child: they are spaced a section apart. |
header Needed | ReactNode | The site's header, usually a <SiteHeader>. |
footer | ReactNode | What goes in the footer: the logo, links, contact. A hairline sits above it. |
It also takes the 279 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 div.ui-container.ui-site-page > header + main.ui-site-main + footer.ui-site-footer.
With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:
components/page-transitions.cssLayout: states, do and don’t
One page of a site: the header, the page's sections (each a direct child) and the footer in the page column, spaced for you (see The page).
States. Layout follows the box it is in, not the window: Split, Grid, AppShell and the site parts stack when their box is narrow, at any width of the window.
Do
- Space with
gap(Stack,Row,Grid), never with margins on children. - Put the page's sections straight on the page, under their titles; a
Cardis one thing a person picks or acts on. - Check every screen at 320, 375 and 768 px with the narrow check of rule 10.
Don't
- Don't give a box a fixed width, or a
min-heighttogether with anaspect-ratio. - Don't nest a card in a card.
- Don't put two
<main>s on a page: a screen shown inside another page takesMain as="div".