# Empty state

An empty state is what a list, table or view shows when it has nothing to show, together with the next step that makes sense. There are two different kinds: no data yet, and no results for the current filter or search. Meadowstack's `DataTable` draws them as two states with two different actions.

Checked 2 December 2026. By Bohuslav Poláček. https://meadowstack.com/glossary/empty-state/

*DataTable with no rows: a filter that found nothing offers to clear the search, a table with no data at all shows the app's own empty state.*

From `packages/kit/src/components/data-table.tsx` in the Meadowstack repository:

```tsx
if (total === 0) {
  if (isFiltered) {
    return (
      <div data-state="no-results" className={cn(frame, className)}>
        <EmptyState
          icon={<IconSearch aria-hidden="true" />}
          title={strings.noResultsTitle}
          description={strings.noResultsDescription}
          action={
            onClearFilters ? (
              <Button size="sm" onClick={onClearFilters}>
                <IconX aria-hidden="true" />
                {strings.clearSearch}
              </Button>
            ) : null
          }
        />
      </div>
    );
  }
  // Marked for the orientation checks (decision 0009): no data at all, unlike the filtered branch above.
  return (
    <div data-state="empty" className={cn(frame, className)}>
      {emptyState ?? <EmptyState />}
```

## Why it matters in a business app

"No purchase requests" means one thing on a new account and another when the person typed a supplier's name into the search. The first needs a way to create the first request; the second needs the search cleared. Showing the same "Nothing here" for both sends people off to create a record that already exists.

An empty state is also not a blank screen. A table that renders nothing at all looks broken, and people reload or report a bug.

## How Meadowstack handles it

- **Four states, always.** Every data view loads with `useResource()` and renders through `<AsyncState>`: loading, error with retry, empty, content. `npm run check:states` fails on a screen that loads data without it.
- **Two kinds of nothing.** `DataTable` marks `data-state="no-results"` with a search icon and a "Clear search" button, or `data-state="empty"` with the app's own empty state.
- **Small on purpose.** `EmptyState` is a 32px tile with a 16px icon, a 13px title and one line of help: "an empty table is not a hero moment", as the kit's source puts it.
- **Not where a visitor lands.** The review audit's `no-wall` rule checks that the demo's default visitor meets no empty view on any route; a filter with no results is fine.

The [data states pattern](https://meadowstack.com/patterns/data-states/) shows the four states on a full screen.

## Common mistakes

- **An error dressed as empty.** A failed request that shows "No orders" hides the failure. Errors get their own state with a retry.
- **"Showing 0 of 0".** A count is not a next step.
- **A large illustration.** In a working app the empty table sits between real content; a hero picture pushes everything else away.
- **An action the person may not take.** "Create the first invoice" for a role that cannot create invoices is a dead end; hide it.

## Questions

### What should an empty state say?

What is missing and the one next step: create the first record, change the filter, or connect the data source. One line of help is enough.

### Is no results for a search an empty state?

It is a different state. The data exists, the filter hid it, so the next step is to clear or change the filter rather than to create something.

### Should an empty state have an illustration?

In a busy business app usually not. Meadowstack's kit uses a small icon tile and a short line, so the empty table does not outweigh the rest of the screen.

## Related

- [AsyncState: every data view has four states](https://meadowstack.com/components/async-state/) (Components)
- [Loading, error, empty and no results](https://meadowstack.com/patterns/data-states/) (Patterns)
- [A weekly timesheet for an agency](https://meadowstack.com/screens/timesheet/) (Screens)
- [BulkBar: what to do with the selection](https://meadowstack.com/components/bulk-bar/) (Components)
- [DataTable: the table of every list](https://meadowstack.com/components/data-table/) (Components)
- [FilterBar: the one row above a list](https://meadowstack.com/components/filter-bar/) (Components)
