APP-8Recommended
Tell an empty start from an empty search
Show two different empty states. A new account with no records explains the feature and offers the first action. A search or filter with no matches names the filter and offers to clear it.
How to do it
Decide which empty state to show from whether any filter is active, not from the list alone. The first-use state has one line of help and one primary button, such as "Create your first invoice". The no-match state repeats the search words and offers a "Clear filters" button. Never show an empty table with headers only. The API side is to return empty lists as empty.
Examples
TypeScript example
function InvoicesEmpty({ filters, onClear }: { filters: InvoiceFilters; onClear: () => void }) {
if (hasActiveFilters(filters)) {
return <EmptyState title={`No invoices match "${filters.search}"`} action={<Button onClick={onClear}>Clear filters</Button>} />;
}
return <EmptyState title="No invoices yet" text="Send your first invoice in under a minute." action={<LinkButton href="/invoices/new" variant="primary">Create invoice</LinkButton>} />;
}
Python example
def invoices_empty_template(filters: InvoiceFilters) -> str:
if filters.is_active():
return "invoices/empty_no_matches.html"
return "invoices/empty_first_use.html"
How to check
Component tests render the view with no records and no filter, then with a filter and no matches. Each shows its own heading and button.
Related rules
- API-25 Return empty lists as empty in API design
- AIF-23 Say so when nothing relevant was found in AI features
- UXD-2 Build the setup checklist from what the account has done in UX and deceptive design
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/app-ui/data-views/empty-states">Agent Wranglers web app interface playbook</a>. In code you write, add a comment next to it with the same link.