Empty
A centered placeholder for a no-data state: an icon, a message, and an action.
Live demo
Empty is the placeholder a surface shows when it has nothing to show: no search results, an empty inbox, a list before its first item. It is a centered column that styles whatever you put in it, so it renders no markup of its own: an icon in .xtyle-empty__media sits muted and enlarged at the top, the first heading reads as the title, a <p> as the muted body, and buttons in .xtyle-empty__actions line up beneath.
Everything draws from the derived register, and because it only frames content it carries no semantics of its own, so the heading and the action keep theirs. Standalone like Stack, it needs no runtime to render.
When to use
How this component composes with the rest of the set.
Anatomy
The named parts that make up the component, with their selectors.
media
The optional icon or illustration at the top, enlarged and muted. Wrap it in .xtyle-empty__media (a bare <xtyle-icon> also works).
title
The headline: the first heading (or .xtyle-empty__title).
text
The supporting line: a <p> (or .xtyle-empty__text), width-capped for readability.
actions
The button row beneath, wrapped in .xtyle-empty__actions.
Tokens & coverage
What the component consumes, checked live against what the algorithm produces.
Live coverage check against the xtyle-default register
(derive(xtyleDefault, { anchors }) →
coverComponent(manifest, register)). Every token this component
consumes must be a key the algorithm produces.
--fg-0
--fg-2
--fg-3
--font-sans
--space-2
--space-3
--space-4
--space-8
--text-4xl
--text-lg
--text-sm
--weight-semibold
Slots
The placeholder content: a media element, a heading, a paragraph, and an .xtyle-empty__actions row, in that order.
Accessibility
Code
No results
A search empty state: an icon, a headline, a hint, and a reset action.
<xtyle-empty>
<div class="xtyle-empty__media"><xtyle-icon name="search"></xtyle-icon></div>
<h3>No results found</h3>
<p>Try adjusting your filters or search term.</p>
<div class="xtyle-empty__actions">
<xtyle-button variant="subtle">Clear filters</xtyle-button>
</div>
</xtyle-empty>
<script lang="ts">
import { Empty, Icon, Button } from "@xtyle/svelte";
</script>
<Empty>
<div class="xtyle-empty__media"><Icon name="search" /></div>
<h3>No results found</h3>
<p>Try adjusting your filters or search term.</p>
<div class="xtyle-empty__actions">
<Button variant="subtle">Clear filters</Button>
</div>
</Empty>
---
import Empty from "@xtyle/astro/Empty.astro";
import Icon from "@xtyle/astro/Icon.astro";
import Button from "@xtyle/astro/Button.astro";
---
<Empty>
<div class="xtyle-empty__media"><Icon name="search" /></div>
<h3>No results found</h3>
<p>Try adjusting your filters or search term.</p>
<div class="xtyle-empty__actions">
<Button variant="subtle">Clear filters</Button>
</div>
</Empty>