Burger
The two-line button that opens the menu on a small screen
Preview
Use
The code of the preview above
import { useState } from 'react';
import { Burger, Menu, MenuContent, MenuItem, MenuTrigger } from '@/components/ui';
function BurgerDemo() {
const [open, setOpen] = useState(false);
return (
<Menu open={open} onOpenChange={(next: boolean) => setOpen(next)}>
<MenuTrigger render={<Burger open={open} />} />
<MenuContent>
<MenuItem>Today</MenuItem>
<MenuItem>Bookings</MenuItem>
<MenuItem>Clients</MenuItem>
<MenuItem>Invoices</MenuItem>
</MenuContent>
</Menu>
);
}Options
| Option | Type | What it does |
|---|---|---|
open Needed | boolean | Whether the menu it controls is open: the two lines cross into an X. |
className | string | More classes on the outer element, for layout around it (margins, grid placement), not to restyle it. |
It also takes the 292 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 button.ui-burger + aria-expanded.
With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:
components/burger.cssLayout: states, do and don’t
The two-line button that opens the menu on a small screen; the lines cross into an X when it is open.
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".