Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Empty State

FreeNew

What a list or a page shows before it has anything in it: an icon tile, a title, a sentence and up to two actions.

Installation

pnpm dlx shadcn@latest add @viewport/empty-state

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above.

empty-state-demo.tsx
import { Plus, Upload, Users } from "lucide-react";
import { Button } from "@/components/viewport/button";
import { EmptyState } from "@/components/viewport/empty-state";

export default function EmptyStateDemo() {
  return (
    <EmptyState className="max-w-md bg-card" icon={<Users />} title="No contacts yet" description="Contacts appear here as soon as you add one, import a file or connect your inbox.">
      <Button>
        <Plus aria-hidden />
        Add contact
      </Button>
      <Button variant="outline">
        <Upload aria-hidden />
        Import CSV
      </Button>
    </EmptyState>
  );
}

Props

PropTypeDefault
iconReact.ReactNode

An icon that stands for what is missing. Decorative.

—
title*React.ReactNode

What is empty, e.g. "No contacts yet".

—
descriptionReact.ReactNode

One or two sentences on why it is empty and what to do next.

—
as"h2" | "h3" | "h4"

The heading level, so the state fits the page outline.

—
variant"dashed" | "plain"

`dashed` draws a dashed frame, for an empty region inside a page; `plain` has none.

"dashed"

Accessibility

  • A real heading at a level you choose.
  • The icon is decorative and hidden from screen readers.
  • Server component with no client JavaScript.