Data and navigation
Tables that reflow on phones, filters beside lists, visible pagination, tabs and detail on selection.
Data table
A table flows with the page; it does not scroll inside itself unless it is a console table with a sticky header. Headers that sort are buttons, and the header carries aria-sort. Selection has a named checkbox per row and a select-all that shows a partial state. On phones every row becomes a card: the primary column is its title and every other cell keeps its label, so no column is dropped.
| Status | |||
|---|---|---|---|
| 1042: Hold phase ended early | Open | 2h ago | |
| 1039: Export is missing a session | Waiting | 1d ago | |
| 1031: Cannot change login email | Open | 2d ago | |
| 1027: Question about delayed checks | Closed | 5d ago |
Code
"use client";
import { useMemo, useState } from "react";
import { Button, DataTable, SelectionBar, Stack, StatusBadge, type Column, type SortDirection } from "@oxidase/ui";
type Ticket = { id: string; subject: string; status: "Open" | "Waiting" | "Closed"; updated: number };
/* Invented tickets for the example. */
const TICKETS: Ticket[] = [
{ id: "1042", subject: "Hold phase ended early", status: "Open", updated: 2 },
{ id: "1039", subject: "Export is missing a session", status: "Waiting", updated: 26 },
{ id: "1031", subject: "Cannot change login email", status: "Open", updated: 49 },
{ id: "1027", subject: "Question about delayed checks", status: "Closed", updated: 120 },
];
const TONE = { Open: "indicator", Waiting: "warning", Closed: "neutral" } as const;
const columns: Column<Ticket>[] = [
{ key: "subject", header: "Ticket", cell: (row) => `${row.id}: ${row.subject}`, primary: true, sortable: true },
{ key: "status", header: "Status", cell: (row) => <StatusBadge tone={TONE[row.status]}>{row.status}</StatusBadge> },
{ key: "updated", header: "Updated", cell: (row) => (row.updated < 24 ? `${row.updated}h ago` : `${Math.round(row.updated / 24)}d ago`), align: "end", sortable: true },
];
/** Sorting and selection with a bulk action bar. Below 576px each row becomes a labelled card. */
export function TableDemo() {
const [sort, setSort] = useState<{ key: string; direction: SortDirection }>({ key: "updated", direction: "ascending" });
const [selected, setSelected] = useState<Set<string>>(new Set());
const rows = useMemo(() => {
const sorted = [...TICKETS].sort((a, b) =>
sort.key === "subject" ? a.subject.localeCompare(b.subject) : a.updated - b.updated,
);
return sort.direction === "ascending" ? sorted : sorted.reverse();
}, [sort]);
return (
<Stack gap="s12">
<SelectionBar
count={selected.size}
noun={selected.size === 1 ? "ticket" : "tickets"}
onClear={() => setSelected(new Set())}
actions={<Button size="small">Assign to me</Button>}
/>
<DataTable
label="Tickets"
rows={rows}
rowKey={(row) => row.id}
rowLabel={(row) => `ticket ${row.id}`}
columns={columns}
sort={sort}
onSortChange={setSort}
selected={selected}
onSelectedChange={setSelected}
/>
</Stack>
);
}| Prop | Type | Default | Description |
|---|---|---|---|
label | string | None | Names the table and the select-all checkbox. |
rows | readonly Row[] | None | The rows to show, already filtered, sorted, and paged. |
rowKey | (row) => string | None | A stable key per row. |
rowLabel | (row) => string | None | Names a row in "Select" labels, such as "ticket 1042". |
columns | Column<Row>[] | None | key, header, cell, and optional sortable, align, numeric, primary. |
sort | { key, direction } | None | The current sort. With onSortChange, sortable headers become buttons. |
selected | Set<string> | None | Selected row keys. With onSelectedChange, adds the selection column. |
rowHref | (row) => string | None | Links the primary cell to the record. |
activeKey | string | None | The row open beside the table, marked as current. |
empty | ReactNode | None | Shown instead of the table when there are no rows. |
Selection bar
When rows are selected, a bar states how many and offers the bulk actions, and it stays in view while choosing. Its count is announced politely. Clearing the selection removes the bar, so stale bulk actions never linger.
Toolbar and filters
Filters sit beside the list they narrow. A toggle filter shows its pressed state; an applied value, such as a priority, has its own remove button that names it. Clear all is always one step away.
Code
"use client";
import { useState } from "react";
import { Button, Field, FilterChip, SearchInput, Toolbar } from "@oxidase/ui";
const STATUSES = ["Open", "Waiting", "Closed"] as const;
/** Search and filters beside the list they narrow, with applied filters removable one by one. */
export function FilterDemo() {
const [active, setActive] = useState<Set<string>>(new Set(["Open"]));
const [priority, setPriority] = useState<string | null>("Priority: high");
const toggle = (status: string) =>
setActive((current) => {
const next = new Set(current);
if (next.has(status)) next.delete(status);
else next.add(status);
return next;
});
return (
<Toolbar
label="Ticket filters"
start={
<>
<Field label="Search tickets" labelHidden>
<SearchInput placeholder="Search tickets" />
</Field>
{STATUSES.map((status) => (
<FilterChip key={status} pressed={active.has(status)} onToggle={() => toggle(status)}>
{status}
</FilterChip>
))}
{priority ? <FilterChip onRemove={() => setPriority(null)}>{priority}</FilterChip> : null}
</>
}
end={
<Button
size="small"
onClick={() => {
setActive(new Set());
setPriority(null);
}}
>
Clear all
</Button>
}
/>
);
}Pagination
Pagination is always visible, never hidden behind infinite scrolling, and says where the reader is in plain numbers. Each page has its own address.
Code
<Pagination
summary="Showing 21 to 40 of 312"
previous={{ href: "/design/components/data#pagination" }}
next={{ href: "/design/components/data#pagination" }}
component={i}
/>
Tabs
Underlined text tabs. In-page tabs switch panels without leaving the page and follow the tab pattern: arrow keys move, Home and End jump, and only the selected tab is in the tab order. Sections that are separate pages use NavTabs, links marked with aria-current. When the tabs do not fit, the strip scrolls sideways and the hidden edge fades out, and the current tab is brought into view.
Four messages, newest last.
Code
"use client";
import { useState } from "react";
import { TabPanel, Tabs, Text } from "@oxidase/ui";
const TABS = [
{ value: "conversation", label: "Conversation", count: 4 },
{ value: "member", label: "Member" },
{ value: "history", label: "History" },
] as const;
type Tab = (typeof TABS)[number]["value"];
/** In-page tabs. Arrow keys move between tabs; only the selected tab is in the tab order. */
export function TabsDemo() {
const [tab, setTab] = useState<Tab>("conversation");
return (
<div>
<Tabs label="Ticket sections" idBase="ticket" items={TABS} value={tab} onValueChange={setTab} />
{TABS.map((item) => (
<TabPanel key={item.value} idBase="ticket" value={item.value} active={tab === item.value}>
<Text tone="secondary">
{item.value === "conversation"
? "Four messages, newest last."
: item.value === "member"
? "Account details the member shared with support."
: "Status changes and internal notes, in order."}
</Text>
</TabPanel>
))}
</div>
);
}Code
<NavTabs
label="Design system sections"
component={i}
items={[{ href: "/design/components/actions", label: "Actions", current: false }, { href: "/design/components/inputs", label: "Inputs and choices", current: false }, { href: "/design/components/overlays", label: "Overlays", current: false }, { href: "/design/components/content", label: "Content", current: false }, { href: "/design/components/feedback", label: "Feedback and states", current: false }, { href: "/design/components/data", label: "Data and navigation", current: true }]}
/>
Split view
Lists with records open the selected record beside the list from 1152 pixels, and in a dismissible sheet below that. The selection lives in the address, so a reload or a shared link opens the same record.
- 1042: Hold phase ended earlyOpen
- 1039: Export is missing a sessionWaiting
Code
"use client";
import { useState } from "react";
import { Button, KeyValue, ListRow, RowGroup, SplitView, Stack, Text } from "@oxidase/ui";
/* Invented tickets for the example. */
const TICKETS = [
{ id: "1042", subject: "Hold phase ended early", opened: "Today, 09:12", status: "Open" },
{ id: "1039", subject: "Export is missing a session", opened: "Yesterday, 17:40", status: "Waiting" },
];
/**
* A list with the selected record beside it from 1152px, and in a sheet below.
* Nothing is open until a ticket is chosen, so a phone never meets a sheet on
* arrival. In the product the selection lives in the URL, so it survives a reload.
*/
export function SplitDemo() {
const [selected, setSelected] = useState<string | null>(null);
const ticket = TICKETS.find((item) => item.id === selected) ?? null;
return (
<SplitView
detailLabel={ticket ? `Ticket ${ticket.id}` : "Ticket"}
closeLabel={ticket ? `Close ticket ${ticket.id}` : "Close ticket"}
onCloseDetail={() => setSelected(null)}
list={
<RowGroup>
{TICKETS.map((item) => (
<ListRow
key={item.id}
title={`${item.id}: ${item.subject}`}
detail={item.status}
trailing={
<Button size="small" pressed={selected === item.id} onClick={() => setSelected(item.id)}>
Open ticket {item.id}
</Button>
}
/>
))}
</RowGroup>
}
detail={
ticket ? (
<Stack gap="s12">
<Text as="h3" variant="title">
{ticket.subject}
</Text>
<KeyValue
columns={2}
items={[
{ label: "Opened", value: ticket.opened },
{ label: "Status", value: ticket.status },
]}
/>
</Stack>
) : null
}
/>
);
}Message composer
Support writes either a reply, which is emailed to the member, or an internal note, which is not. The choice is stated in words on the control, wrapping onto two lines on a phone, and the button changes with it. The caller can keep a draft per ticket through defaultBody and onBodyChange.
Code
"use client";
import { useState } from "react";
import { FormStatus, MessageComposer, Stack } from "@oxidase/ui";
/** A reply or an internal note. Nothing is sent from this example. */
export function ComposerDemo() {
const [last, setLast] = useState("");
const [key, setKey] = useState(0);
return (
<Stack gap="s8">
<MessageComposer
key={key}
onSubmit={(mode, body) => {
setLast(mode === "reply" ? `A reply of ${body.length} characters would be emailed.` : "A note would be saved without email.");
setKey((value) => value + 1);
}}
/>
<FormStatus>{last}</FormStatus>
</Stack>
);
}- A reply's consequence is stated before sending, not after.
- Sending is disabled until there is text; the count is announced with the field.