Tabs
Views of one thing that share a place, one shown at a time. Holds a TabsList and a TabsPanel for each tab.
Preview
3 bookings this week, the next on Friday at 09:30
Use
import { Tab, Tabs, TabsList, TabsPanel } from '@/components/ui';
<div className="ui-grow">
<Tabs defaultValue="upcoming">
<TabsList aria-label="Bookings">
<Tab value="upcoming">Upcoming</Tab>
<Tab value="past">Past</Tab>
<Tab value="cancelled">Cancelled</Tab>
</TabsList>
<TabsPanel value="upcoming"><p>3 bookings this week, the next on Friday at 09:30</p></TabsPanel>
<TabsPanel value="past"><p>128 bookings since March</p></TabsPanel>
<TabsPanel value="cancelled"><p>2 cancelled in November, both moved to December</p></TabsPanel>
</Tabs>
</div>Options
| Option | Type | What it does |
|---|---|---|
className | string | More classes on the outer element, for layout around it (margins, grid placement), not to restyle it. |
It also takes the 288 attributes of the element or UI SDK part it draws: className, aria-label, events and the rest.
Parts
What goes inside one.
Without React
The same look on any HTML, with the classes ui-tabs…, ui-tabs-list--pills.
With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:
components/tabs.csscomponents/small-things.csscomponents/calendar.cssIn the examples
Small screens made with it and the rest of the kit. They work: click, type and choose in them.
| Kestrel Studio | Website | €1,200.00 |
| Lumen Bakery | Menu design | €340.00 |
| Northwind Joinery | Signage | €2,780.00 |
- Algebra, TomMon 16:00
- Forces, LeaTue 17:30
Showing things: states, do and don’t
Views of one thing; variant="pills" for the round style. For pages, use links with className="ui-tab".
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.