Empty & Loading States

Empty, error, success and loading states, plus skeletons.

Category
Data & feedback
Access
Free with an account
Source
128 lines · one file

When to use it

Use Empty & Loading States for what a region shows when there is nothing, it failed, it worked, or it is loading: an icon, title, description and actions. Skeleton is the shimmering placeholder for content on its way.

Installation

How you get it

Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.

Use Liro's Empty & Loading States for this.
Install it: npx shadcn@latest add @liro/state
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/state.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.

For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Free components install through the @liro registry with your CLI token: see the Namespaced tab.

Usage

components/invoices-empty.tsx
import { Button } from "@/components/ui/button";
import { Skeleton, State } from "@/components/ui/state";

export function InvoicesEmpty({ loading, create }: { loading: boolean; create: () => void }) {
  if (loading) return <Skeleton lines={4} />;
  return (
    <State
      kind="empty"
      title="No invoices yet"
      description="Invoices appear here after your first charge."
      action={<Button onClick={create}>Create invoice</Button>}
      framed
    />
  );
}

API reference

“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.

Props

Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.

TypeNotes
kindStateKind No–
titleReact.ReactNode Yes–
descriptionReact.ReactNode No–
iconReact.ReactNode NoReplace the default icon.
sceneEmptyIllustrationName NoFor an empty state: the drawn, gently animated scene to show (Empty States). Default "inbox"; "search" for no matches.
actionReact.ReactNode NoThe primary action — one.
secondaryActionReact.ReactNode NoA quieter second action, a link to docs.
framedboolean NoDraw a dashed frame — for an empty region inside a page.
size"sm" | "md" No–

Dependencies

npm packages

clsxlucide-reacttailwind-merge

Liro foundations, installed alongside it

liro-themeempty-states

Accessibility

  • Keyboard reachable throughout, in visual order
  • Focus trapped in overlays, Escape closes them
  • Focus returns to whatever opened it
  • Live regions announce what changed, not that something did
  • Honours prefers-reduced-motion

Responsive behavior

  • Sizes to its container, not the viewport
  • Usable from 320px up
  • Pointer-based interaction, so trackpad and touch both work
  • No hover-only affordances

Used in screensAll screens