Skeleton
Loading placeholders.
View code
<Card aria-busy="true" aria-label="Loading comments">
<Card.Content>
<div mix={[hstack({ gap: 3, align: "center" })]}>
<Skeleton mix={[pulse(), css({ inlineSize: "2.5rem", blockSize: "2.5rem", borderRadius: "9999px", flexShrink: "0" })]} />
<div mix={[vstack({ gap: 2, align: "stretch" }), css({ flexGrow: "1" })]}>
<Skeleton mix={[pulse(), css({ inlineSize: "9rem" })]} />
<Skeleton mix={[pulse(), css({ inlineSize: "5rem", blockSize: "0.75rem" })]} />
</div>
</div>
<div mix={[vstack({ gap: 2, align: "stretch" })]}>
<Skeleton mix={[pulse()]} />
<Skeleton mix={[pulse()]} />
<Skeleton mix={[pulse(), css({ inlineSize: "60%" })]} />
</div>
<div mix={[hstack({ gap: 2, align: "center" })]}>
<Skeleton mix={[pulse(), css({ inlineSize: "4.5rem", blockSize: "2rem", borderRadius: "9999px" })]} />
<Skeleton mix={[pulse(), css({ inlineSize: "4.5rem", blockSize: "2rem", borderRadius: "9999px" })]} />
</div>
</Card.Content>
</Card>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 { Skeleton } from "@sdxc/ui/app";A static loading placeholder: a rounded block filled with the neutral
border color, sized to its container and one text line tall by default.
Compose pulse() or shimmer() through mix for a motion cue.
Composition
The parts the component publishes, each a static property of the host.
SkeletonSkeleton.RowA placeholder table row built from the realTable.RowandTable.Cell, so it takes--ui-table-row-block-sizeand the table's cell padding and rules; place it in a real table body.Skeleton.TableA placeholder table body ofrowsSkeleton.Rows, for under the real table header while the first page loads, so the header, columns and height hold still when the data arrives.Skeleton.StatA placeholder stat card drawn inside the realStatCardframe, with bars on the label and value lines and the delta placed as a real one is in every group layout, so it is as tall as the card it precedes;deltaandchartadd parts.Skeleton.ListA placeholder list ofrowsrows at--ui-skeleton-list-row-block-size(3.5rem, a two-line row), each an optional avatar and one or two text bars; set the variable to the real list's row height.Skeleton.TextLays out real content unseen and paints a bar over each line it wraps to, so a placeholder takes exactly the content's size at every width: a name that wraps on a phone wraps in its placeholder too.
Examples
Table body
| Monitor | Status | Uptime | Last check |
|---|
View code
<Table>
<Table.Header>
<Table.Row>
<Table.Column>Monitor</Table.Column>
<Table.Column>Status</Table.Column>
<Table.Column>Uptime</Table.Column>
<Table.Column>Last check</Table.Column>
</Table.Row>
</Table.Header>
<Skeleton.Table rows={5} columns={4} label="Loading monitors" />
</Table>Stat cards
View code
<div role="status" aria-busy="true" aria-label="Loading stats" mix={[hstack({ gap: 3, align: "start" })]}>
<Skeleton.Stat delta />
<Skeleton.Stat delta chart />
</div>List
View code
<Skeleton.List rows={4} avatar label="Loading conversations" />Text
View code
<div aria-busy="true">
<strong><Skeleton.Text>{person.name}</Skeleton.Text></strong>
<p><Skeleton.Text>{person.bio}</Skeleton.Text></p>
<Skeleton.Text block><Button size="sm">Follow</Button></Skeleton.Text>
</div>Announced to screen readers
View code
<div mix={[is("16rem")]}>
<Skeleton role="status" aria-hidden="false" aria-label="Loading Ana's profile" />
</div>Round avatar
View code
<Skeleton style={{ blockSize: "2.5rem", inlineSize: "2.5rem", borderRadius: "9999px" }} />Props
Read from the component's own types, so every prop, every default and every allowed value is listed.
Also accepts everything in TagProps<"div">.
Skeleton.Row
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
columns | number | — | No | Cells in the row; match the real table's columns. Default: 4. |
Also accepts everything in TagProps<"tr">.
Skeleton.Table
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
rows | number | — | No | Placeholder rows. Default: 5. |
columns | number | — | No | Cells per row; match the real table's columns. Default: 4. |
Also accepts everything in TagProps<"tbody">.
Also accepts everything in Labelled.
Skeleton.Stat
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
delta | boolean | — | No | Draws the delta pill where a card with a delta sets it. |
chart | boolean | — | No | Draws the chart band under the value, as a card with a sparkline has. |
Also accepts everything in Omit<TagProps<"div">, "children">.
Also accepts everything in Labelled.
Skeleton.List
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
rows | number | — | No | Placeholder rows. Default: 5. |
avatar | boolean | — | No | Leads each row with a round avatar placeholder. |
lines | 1 | 2 | — | No | Text lines per row. Default: 2. |
Also accepts everything in TagProps<"div">.
Also accepts everything in Labelled.
Skeleton.Text
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
block | boolean | — | No | Draws one bar over the whole box instead of one per wrapped line, for an inline-flex box such as a badge or a button. @default false |
Also accepts everything in TagProps<"span">.