GridList
An interactive row list built from plain, already-ordered markup.
View code
let model = new SelectionModel({ keys: THREADS.map((thread) => thread.id) });
// ref() fires on insert, so the subscription is set up in the browser and torn
// down with the node — the server renders the list without one.
let followSelection = ref((_node, signal) => {
model.addEventListener("change", () => void handle.update(), { signal });
});
<div mix={[followSelection]}>
<div mix={[hstack({ gap: 2, align: "center" })]}>
<Button variant="outline" color="neutral" size="sm" disabled={model.isEmpty}>
<ArchiveIcon />
Archive
</Button>
<Button variant="outline" color="danger" size="sm" disabled={model.isEmpty}>
<TrashIcon />
Delete
</Button>
<Badge color="neutral">{model.size} selected</Badge>
</div>
<GridList aria-label="Inbox" mix={[gridListKeys(model)]}>
{SECTIONS.map((section) => (
<GridList.Section key={section} aria-labelledby={`inbox-${section}`}>
<GridList.Header id={`inbox-${section}`}>{section}</GridList.Header>
{THREADS.filter((thread) => thread.section === section).map((thread) => (
<GridList.Item key={thread.id} id={thread.id}>
<MailIcon aria-hidden="true" />
<span mix={[is("7rem"), shrink(), truncate()]}>{thread.from}</span>
<span mix={[basis(0), grow(), truncate()]}>{thread.subject}</span>
<span mix={[basis(0), grow(), truncate()]}>{thread.preview}</span>
</GridList.Item>
))}
</GridList.Section>
))}
</GridList>
</div>Demo apps
Whole pages built only from @sdxc/ui, each for an invented product with its own palette and type. They open in a new tab.
- Food deliveryBocadoBocado, an invented food delivery app: restaurants by cuisine and delivery time, search with filters, menus with options, a cart, checkout and live order tracking on a drawn map./showcase/bocado/demo
- Issue trackerCairnCairn, an invented issue tracker: grouped issue lists with filters in the address, a drag-and-drop board, projects on a roadmap, cycles with burn-up charts and an inbox./showcase/cairn/demo
- Social networkChorusChorus, an invented social network: a live timeline with pictures, link cards, polls and threads, profiles, grouped notifications, search and messages./showcase/chorus/demo
- Code hostDeltaDelta, a code host whose one repository is its own source: a file tree beside the code, line links, blame and the commits list, every file and commit read from git when the site is built./showcase/delta/demo
- Online storeHangwellHangwell, an invented poster shop: collections with facet filters, product pages with format, size and frame pickers and a room preview, a bag, a checkout that adapts to print files, order tracking, downloads and returns./showcase/hangwell/demo
- CMSInkwellInkwell, a demo CMS built from @sdxc/ui/app: posts with count tabs and quick edit, an editor with a quiet save status and a loud Publish, media and settings./showcase/inkwell/demo
- Music streamingMurmurMurmur, an invented music service: home shelves, search by genre, a library, albums, playlists and artists, with a player that keeps playing while you browse./showcase/murmur/demo
- Team chatParleyParley, an invented team chat: channels and direct messages with unread and mention badges, threads, reactions, edits, pins, search, a quick switcher and teammates who type and post live./showcase/parley/demo
- Photo and video networkPinholePinhole, an invented social network for photographs and short videos: a feed under a story tray, full-screen stories, a vertical reels feed, profiles with highlights, Explore and posts with comments./showcase/pinhole/demo
- Ops dashboardPulsePulse, an invented ops dashboard: Northwind's services with live filters, a peek sheet and a bulk bar, metrics that switch one chart, incidents, deploys and settings./showcase/pulse/demo
- Support inboxRelayRelay, an invented support inbox: mailboxes, conversations and the open conversation on one screen, with contacts, reports and settings./showcase/relay/demo
- CalendarSundialSundial, an invented calendar: day, week and month views, an agenda, events you drag, resize and create on the grid, a second time zone, and a find-a-time view across a team in five zones./showcase/sundial/demo
- Chat assistantTernTern, an invented chat assistant: conversations with streamed replies, code and tables, projects, a canvas, sharing and settings./showcase/tern/demo
- Banking & budgetsTuppenceTuppence, an invented personal bank: multi-currency accounts, a statement by day with search and splits, spending and budgets, savings pots, bills ahead, cards that freeze and a transfer flow, all with fake money./showcase/tuppence/demo
- Streaming serviceVesperVesper, an invented streaming service: profiles, a home of sideways shelves under a billboard, series with seasons and episodes, search, My List and a theater player./showcase/vesper/demo
- Travel bookingWayfernWayfern, an invented travel app: stays, flights, cars and packages from one search, results on a real map, seat maps and boarding passes, and one itinerary of trips that exports to calendars./showcase/wayfern/demo
Every demo, landings and docs sites alike, is listed in the showcase.
Installation
An ordinary dependency: install it, import the theme once, and import the component where it is used.
npm add @sdxc/ui remiximport "@sdxc/ui/theme.css";Usage
import { GridList } from "@sdxc/ui/app";Renders the list's root host as a bordered <div> with role="grid",
keeping its row-list layer in an inner wrapper since a @container query
can't resolve against the host that declares it; a & > [data-slot=list] selector
on mix reaches that wrapper.
Composition
The parts the component publishes, each a static property of the host.
GridListGridList.ItemRenders a single row: a<div>carryingrole="row", itsidmirrored onto adata-rmx-keyattribute so a paired selection, keyboard-navigation, or reorder behavior can correlate the row with its own state.GridList.SectionRenders a titled group of rows: a<div>carryingrole="rowgroup", stacking an optional GridList.Header above its GridList.Item rows, with a block-start rule before every section but the first.GridList.HeaderRenders a section's label: a<header>styled as small, muted, uppercase text for the GridList.Item rows nested beneath it in a GridList.Section; point the section'saria-labelledbyat itsid.GridList.DragHandleRenders a row's drag grip as a native<button type="button">written before the consumer's attributes, so acommand/commandforpair still runs inside a<form>; its pointer target grows to--ui-target-sizearound the 16px glyph.
Examples
Grid layout
View code
<GridList aria-label="Gallery" layout="grid">
<GridList.Item id="photo-1">
<ImageIcon />
Sunset
</GridList.Item>
<GridList.Item id="photo-2">
<ImageIcon />
Harbor
</GridList.Item>
<GridList.Item id="photo-3">
<ImageIcon />
Lighthouse
</GridList.Item>
<GridList.Item id="photo-4">
<ImageIcon />
Old town
</GridList.Item>
</GridList>Props
Read from the component's own types, so every prop, every default and every allowed value is listed.
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
layout | "stack" | "grid" | — | No | Row arrangement. Defaults to DEFAULT_LAYOUT. |
children | RemixNode | — | Yes | GridList.Item, GridList.Section, and GridList.LoadMoreItem rows to render. |
Also accepts everything in TagProps<"div">.
GridList.Item
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
id | string | — | Yes | Stable identifier for this row, mirrored onto both the rendered element's own id and a data-rmx-key attribute, so the row is already correlation-ready for a paired behavior once one is attached. |
Also accepts everything in TagProps<"div">.
GridList.Section
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
children | RemixNode | — | Yes | The section's optional GridList.Header label, followed by its GridList.Item rows. |
Also accepts everything in TagProps<"div">.
GridList.Header
Also accepts everything in TagProps<"header">.
GridList.DragHandle
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
"aria-label" | string | — | Yes | Accessible name for the icon-only control, e.g. "Reorder" or "Drag to reorder". |
Also accepts everything in Omit<TagProps<"button">, "type" | "children">.
Types
| Name | Values | What it decides |
|---|---|---|
Layout | "stack" | "grid" | Arrangement of GridList.Item rows: "stack" renders them as a single column, "grid" wraps them into a multi-column layout growing from two columns up to four as the list's own container widens. |