Empty
A placeholder for a product section that has nothing to show, typed by why.
Northwind Traders
Contoso
Fabrikam
View code
let query = "";
let matches = INVOICES.filter((invoice) =>
`${invoice.id} ${invoice.client}`.toLowerCase().includes(query.trim().toLowerCase()),
);
<Group>
<Input
name="q"
type="search"
value={query}
placeholder="Search invoices"
aria-label="Search invoices"
mix={[
on<HTMLInputElement, "input">("input", (event) => {
query = event.currentTarget.value;
void handle.update();
}),
]}
/>
</Group>
{matches.length > 0 ? (
matches.map((invoice) => (
<Item key={invoice.id}>
<Item.Media>
<FileTextIcon aria-hidden="true" />
</Item.Media>
<Item.Content>
<Item.Title>{invoice.id}</Item.Title>
<Item.Description>{invoice.client}</Item.Description>
</Item.Content>
<Item.Actions>{invoice.amount}</Item.Actions>
</Item>
))
) : (
<Empty>
<Empty.Icon>
<SearchIcon />
</Empty.Icon>
<Empty.Title>No invoices match “{query.trim()}”</Empty.Title>
<Empty.Description>
Search runs over the invoice number and the client's name. Nothing in this workspace
matches either.
</Empty.Description>
<Empty.Action>
<Button variant="outline" color="neutral" mix={[on("click", clearQuery)]}>
Clear the search
</Button>
<Button>New invoice</Button>
</Empty.Action>
</Empty>
)}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 { Empty } from "@sdxc/ui/app";Renders the empty-state panel, a column tinted to its color role. A kind
leads with its own icon and frame: a dashed outline for a first run, no
frame for no results or a cleared list, a solid one for permission or error.
Composition
The parts the component publishes, each a static property of the host.
EmptyEmpty.IconRenders Empty.IconProps.children as the icon well: a fully rounded, tinted badge framing an icon graphic hidden from assistive technology, since Empty.Title's text already names the state.Empty.TitleRenders Empty.TitleProps.children as the empty state's heading, in the native heading element matching its ambientHeadingScopedepth (or<h1>unscoped), sized as the panel's primary text regardless of level.Empty.DescriptionRenders Empty.DescriptionProps.children as the empty state's supporting copy, in a native<p>set to seventy percent of the panel's current text color so it reads as secondary to Empty.Title.Empty.ActionRenders Empty.ActionProps.children as the empty state's call-to-action slot: a centered, wrapping row spaced a touch below the text above it, so a state offering more than one action lays them out rather than running them together.Empty.QueryRenders the reader's query inside ano-resultsdescription as a native<q>, so the browser adds the locale's own quotation marks around it and the reader sees exactly what to change.Empty.RequestIdRenders anerrorstate's request id line: a label such as "Request ID", then the Empty.RequestIdValue, in small muted text.Empty.RequestIdValueThe failed request's id in monospace that selects whole on one click, so the reader can copy it into a support message without a script.
Examples
First run
Create your first monitor
Monitors check a URL every minute and tell you when it stops answering.
View code
<Empty kind="first-run">
<Empty.Title>Create your first monitor</Empty.Title>
<Empty.Description>
Monitors check a URL every minute and tell you when it stops answering.
</Empty.Description>
<Empty.Action>
<Button>Create Monitor</Button>
</Empty.Action>
</Empty>No results
No monitors match
Nothing matched status:down region:fra
. Try another region.
View code
<Empty kind="no-results">
<Empty.Title>No monitors match</Empty.Title>
<Empty.Description>
Nothing matched <Empty.Query>status:down region:fra</Empty.Query>. Try another region.
</Empty.Description>
<Empty.Action>
<Button variant="outline">Clear filters</Button>
</Empty.Action>
</Empty>All caught up
All caught up
No open incidents. New ones land here as they start.
View code
<Empty kind="cleared">
<Empty.Title>All caught up</Empty.Title>
<Empty.Description>No open incidents. New ones land here as they start.</Empty.Description>
</Empty>No permission
Billing is for owners
Ask Ana Ruiz, the team owner, to give you access.
View code
<Empty kind="permission">
<Empty.Title>Billing is for owners</Empty.Title>
<Empty.Description>Ask Ana Ruiz, the team owner, to give you access.</Empty.Description>
</Empty>Error
Couldn't load incidents
The server took too long to answer. Try again.
Request ID req_01JD8Z3K4R7Y2M
View code
<Empty kind="error">
<Empty.Title>Couldn't load incidents</Empty.Title>
<Empty.Description>The server took too long to answer. Try again.</Empty.Description>
<Empty.Action>
<Button variant="outline">Retry</Button>
</Empty.Action>
<Empty.RequestId>
Request ID <Empty.RequestIdValue>req_01JD8Z3K4R7Y2M</Empty.RequestIdValue>
</Empty.RequestId>
</Empty>Compact, inside a card
No failing checks
Every monitor answered in the last hour.
View code
<Card>
<Card.Content>
<Empty kind="cleared" size="compact">
<Empty.Title>No failing checks</Empty.Title>
<Empty.Description>Every monitor answered in the last hour.</Empty.Description>
</Empty>
</Card.Content>
</Card>Danger color
We could not find that project
View code
<Empty color="danger">
<Empty.Title>We could not find that project</Empty.Title>
</Empty>Props
Read from the component's own types, so every prop, every default and every allowed value is listed.
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
color | "brand" | "neutral" | "success" | "warning" | "danger" | — | No | Semantic tone of the panel. Default: the kind's tone, else "neutral". |
kind | "first-run" | "no-results" | "cleared" | "permission" | "error" | — | No | Why it is empty; draws that cause's icon, tone and frame. An Empty.Icon among the children takes the default icon's place, and a hidden one leaves none. |
size | "default" | "compact" | — | No | Default: "default". |
children | RemixNode | — | Yes | The panel's compound parts: Empty.Icon, Empty.Title, Empty.Description, Empty.Action, or any other content. |
Also accepts everything in TagProps<"div">.
Empty.Icon
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
children | RemixNode | — | No | Icon graphic rendered inside the icon well. |
Also accepts everything in TagProps<"div">.
Empty.Title
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
children | RemixNode | — | Yes | Heading copy for the empty state. |
Also accepts everything in TagProps<"h1">.
Empty.Description
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
children | RemixNode | — | Yes | Supporting copy elaborating on the empty state. |
Also accepts everything in TagProps<"p">.
Empty.Action
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
children | RemixNode | — | Yes | Call-to-action content, typically a button or link. |
Also accepts everything in TagProps<"div">.
Empty.Query
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
children | RemixNode | — | Yes | The search text or filter the reader typed, verbatim. |
Also accepts everything in TagProps<"q">.
Empty.RequestId
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
children | RemixNode | — | Yes | A label such as "Request ID", then the Empty.RequestIdValue. |
Also accepts everything in TagProps<"p">.
Empty.RequestIdValue
Also accepts everything in TagProps<"code">.
Types
| Name | Values | What it decides |
|---|---|---|
Color | "brand" | "neutral" | "success" | "warning" | "danger" | Semantic tone driving the panel's border, tint, and foreground color through the --ui-* variables for that color. |
Kind | "first-run" | "no-results" | "cleared" | "permission" | "error" | Why the section is empty: first-run (welcome, one create action), no-results (quote the query, offer Clear filters), cleared ("All caught up"), permission (name who grants access), error (Retry and the request id). |
Size | "default" | "compact" | "compact" tightens the panel and drops its frame, so it sits flush inside a card or a table body. |