Skip to content
caliper ui docs

Components

Empty state

A message with an icon and a next step for when there is nothing to show.

Free
pnpm dlx shadcn@latest add @caliper/empty-state

Team members

Northwind workspace · 4 people

No members match “zed”

Check the spelling or clear the search to see everyone on the team.

Installs components/ui/empty-state.tsxDepends on none beyond ReactMotion none in component source

When to use

Use it for

  • A list, search or inbox has no content.
  • Teaching what to do first.

Skip it when

  • Content is only loading; use a skeleton.
  • An error occurred; use an alert.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/empty-state

Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

This is the code behind the preview above.

example.tsx
import { Search, SearchX } from "lucide-react"
import { useState, type ReactNode } from "react"
import { Avatar } from "@/components/ui/avatar"
import { Button } from "@/components/ui/button"
import { EmptyState } from "@/components/ui/empty-state"
import { Input } from "@/components/ui/input"

function Panel({ title, context, className = "max-w-md", children }: { title: string; context: string; className?: string; children: ReactNode }) {
  return (
    <section className={`grid w-full gap-5 rounded-overlay border border-border bg-background p-6 shadow-resting ${className}`}>
      <div className="grid gap-1">
        <p className="font-medium">{title}</p>
        <p className="text-sm text-muted-foreground">{context}</p>
      </div>
      {children}
    </section>
  );
}

const members = [
  { name: "Amara Okafor", role: "Engineering lead" },
  { name: "Dev Patel", role: "Product designer" },
  { name: "Lena Fischer", role: "Support" },
  { name: "Tomas Ferreira", role: "Finance" },
];

export function EmptyStateDemo() {
  const [query, setQuery] = useState("zed");
  const found = members.filter((m) => m.name.toLowerCase().includes(query.trim().toLowerCase()));
  return (
    <Panel title="Team members" context="Northwind workspace · 4 people">
      <Input aria-label="Search members" value={query} onChange={(e) => setQuery(e.target.value)} leading={<Search aria-hidden="true" />} />
      {found.length ? (
        <ul className="grid gap-3">
          {found.map((m) => (
            <li key={m.name} className="flex items-center gap-3">
              <Avatar name={m.name} />
              <div className="min-w-0">
                <p className="text-sm font-medium">{m.name}</p>
                <p className="text-xs text-muted-foreground">{m.role}</p>
              </div>
            </li>
          ))}
        </ul>
      ) : (
        <EmptyState
          icon={<SearchX aria-hidden="true" />}
          title={`No members match “${query.trim()}”`}
          description="Check the spelling or clear the search to see everyone on the team."
        >
          <Button variant="secondary" size="sm" onClick={() => setQuery("")}>Clear search</Button>
        </EmptyState>
      )}
    </Panel>
  );
}

API reference

EmptyState

component

Also accepts the native props of its root element and a ref.

PropTypeDefault
title *string—
descriptionstring—
iconReactNode—

Accessibility

It is built on native elements and keeps aria-hidden in step with state.

No custom key handling; Tab and the native activation keys do the work.

Motion

It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.

All Feedback examples