Skip to content
Product block

Empty State With Illustration

Two variants — nothing created yet, versus filters excluded everything — because offering "create your first" to a bad filter is the classic bug.

131 lineslucide-reactAdded 8 Aug 2026
  • empty state
  • zero state
  • illustration
  • onboarding
  • svg

What's included

  • components/empty-state-cta.tsx
  • Needs lucide-react

Works with

  • React
  • Next.js
  • Tailwind CSS
  • TypeScript

npx hoverlab add empty-state-cta

Or over MCP, from your editor's agent — no account needed.

License

Free to read, copy and install, for personal and non-commercial projects. Shipping it in client work or a paid product needs Pro ($79 once). The source lands in your repo and stops being ours — no attribution, nothing to upgrade.

Was this useful?

Start a page with this section — add more, order them, and leave with the page source.

Preview

No projects yet

Projects hold your work and your team’s. Create one to get started — it takes about ten seconds.

Rendered live in your current theme — this is the same component whose source is below, not a screenshot of it.

Source

components/empty-state-cta.tsx
/**
 * <EmptyState> — the "nothing here yet" panel.
 *
 * The distinction that matters: an empty list because you have not created
 * anything is a different screen from an empty list because your filters
 * excluded everything. The first wants an onboarding pitch and a create
 * button; the second wants "clear filters" and nothing else. Pass
 * `variant="filtered"` for the second — offering "Create your first
 * project" to someone who has forty projects and a bad filter is the
 * classic version of this bug.
 *
 * The illustration is inline SVG built from the same design tokens, so it
 * themes with the page instead of being a light-mode PNG on a dark card.
 */

import * as React from 'react'
import { Plus, FilterX, BookOpen } from 'lucide-react'

export interface EmptyStateProps {
  variant?: 'empty' | 'filtered'
  title?: string
  description?: string
  primaryLabel?: string
  secondaryLabel?: string
  onPrimary?: () => void
  onSecondary?: () => void
  className?: string
}

export function EmptyState({
  variant = 'empty',
  title,
  description,
  primaryLabel,
  secondaryLabel,
  onPrimary,
  onSecondary,
  className = '',
}: EmptyStateProps) {
  const filtered = variant === 'filtered'

  const resolvedTitle =
    title ?? (filtered ? 'No results match those filters' : 'No projects yet')

  const resolvedDescription =
    description ??
    (filtered
      ? 'Try widening the date range or removing a filter. Nothing has been deleted.'
      : 'Projects hold your work and your team’s. Create one to get started — it takes about ten seconds.')

  const resolvedPrimary = primaryLabel ?? (filtered ? 'Clear filters' : 'New project')
  const resolvedSecondary = secondaryLabel ?? (filtered ? undefined : 'Read the guide')

  return (
    <div
      className={`flex flex-col items-center justify-center rounded-2xl border border-dashed border-border/60 bg-card/40 px-6 py-14 text-center ${className}`}
    >
      <EmptyIllustration filtered={filtered} />

      <h2 className="mt-6 text-lg font-bold tracking-tight">{resolvedTitle}</h2>
      <p className="mx-auto mt-2 max-w-sm text-sm text-muted-foreground">
        {resolvedDescription}
      </p>

      <div className="mt-6 flex flex-wrap items-center justify-center gap-3">
        <button
          type="button"
          onClick={onPrimary}
          className="inline-flex items-center gap-2 rounded-xl bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground transition-colors hover:bg-primary/90"
        >
          {filtered ? (
            <FilterX aria-hidden className="h-4 w-4" />
          ) : (
            <Plus aria-hidden className="h-4 w-4" />
          )}
          {resolvedPrimary}
        </button>

        {resolvedSecondary ? (
          <button
            type="button"
            onClick={onSecondary}
            className="inline-flex items-center gap-2 rounded-xl border border-border/60 bg-background px-4 py-2.5 text-sm font-medium transition-colors hover:bg-muted"
          >
            <BookOpen aria-hidden className="h-4 w-4" />
            {resolvedSecondary}
          </button>
        ) : null}
      </div>
    </div>
  )
}

/**
 * Inline SVG rather than an image file: it inherits `currentColor`, so it
 * is correct in both themes and needs no second asset, no request and no
 * space reserved against layout shift.
 */
function EmptyIllustration({ filtered }: { filtered: boolean }) {
  return (
    <svg
      aria-hidden
      viewBox="0 0 120 90"
      className="h-24 w-32 text-muted-foreground/30"
      fill="none"
      stroke="currentColor"
      strokeWidth="2"
      strokeLinecap="round"
      strokeLinejoin="round"
    >
      <rect x="18" y="14" width="84" height="62" rx="8" />
      <path d="M18 32h84" />
      <circle cx="28" cy="23" r="2.5" fill="currentColor" stroke="none" />
      <circle cx="37" cy="23" r="2.5" fill="currentColor" stroke="none" />

      {filtered ? (
        <>
          <path d="M46 46h28l-11 12v10l-6-3V58z" className="text-muted-foreground/50" />
          <path d="M78 44l14 14M92 44l-14 14" className="text-destructive/40" />
        </>
      ) : (
        <>
          <path d="M34 46h30M34 56h44M34 66h22" className="text-muted-foreground/40" />
          <circle cx="86" cy="60" r="12" className="text-primary/40" />
          <path d="M86 54v12M80 60h12" className="text-primary/50" />
        </>
      )}
    </svg>
  )
}

Before you paste

  • Styling is Tailwind utility classes on semantic tokens (bg-card, text-muted-foreground) — it inherits your theme instead of overriding it.
  • Install: npm i lucide-react
  • Every prop has a default, so it renders standalone before you wire it up.

Where it goes

Drop it at components/empty-state-cta.tsx and import it where you need the section:

import { EmptyState } from '@/components/empty-state-cta'

Customize

1 of this block’s props are simple enough to drive from here. Change them and the block below re-renders — it is the same component whose source is above, not a mock of it. Everything else it accepts is in the table underneath.

Props

Read out of the component’s own type and signature, so this cannot drift from the source below. Every prop has a default — the component renders standalone before you pass it anything.

PropTypeDefault
variant'empty' | 'filtered''empty'
titlestring—
descriptionstring—
primaryLabelstring—
secondaryLabelstring—
onPrimary() => void—
onSecondary() => void—
classNamestring''

Not using React?

The same block rendered once to markup, wrapped as a file your framework compiles. Tailwind classes are framework-agnostic, so the design transfers intact — the behaviour does not.

empty-state-cta.html
<!--
  Empty State With Illustration — markup from the Hoverlab catalog.

  This is the block rendered once to HTML and wrapped as a component
  file. It is not a port of the React source: the Tailwind classes carry
  the design, which is the part that took the work, and they are the same
  in every framework.

  This block has no interactive behaviour, so nothing is missing.
-->
<div class="flex flex-col items-center justify-center rounded-2xl border border-dashed border-border/60 bg-card/40 px-6 py-14 text-center ">
  <svg aria-hidden="true" viewBox="0 0 120 90" class="h-24 w-32 text-muted-foreground/30" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
    <rect x="18" y="14" width="84" height="62" rx="8"></rect>
    <path d="M18 32h84"></path>
    <circle cx="28" cy="23" r="2.5" fill="currentColor" stroke="none"></circle>
    <circle cx="37" cy="23" r="2.5" fill="currentColor" stroke="none"></circle>
    <path d="M34 46h30M34 56h44M34 66h22" class="text-muted-foreground/40"></path>
    <circle cx="86" cy="60" r="12" class="text-primary/40"></circle>
    <path d="M86 54v12M80 60h12" class="text-primary/50"></path>
  </svg>
  <h2 class="mt-6 text-lg font-bold tracking-tight">No projects yet</h2>
  <p class="mx-auto mt-2 max-w-sm text-sm text-muted-foreground">Projects hold your work and your team’s. Create one to get started — it takes about ten seconds.</p>
  <div class="mt-6 flex flex-wrap items-center justify-center gap-3">
    <button type="button" class="inline-flex items-center gap-2 rounded-xl bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground transition-colors hover:bg-primary/90"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-plus h-4 w-4" aria-hidden="true"><path d="M5 12h14"></path><path d="M12 5v14"></path></svg>New project</button>
    <button type="button" class="inline-flex items-center gap-2 rounded-xl border border-border/60 bg-background px-4 py-2.5 text-sm font-medium transition-colors hover:bg-muted"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-book-open h-4 w-4" aria-hidden="true"><path d="M12 7v14"></path><path d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"></path></svg>Read the guide</button>
  </div>
</div>
  • This is rendered HTML, not a translation of the React source. The Tailwind classes carry the design and work in any framework.
  • It is one frame: the component in its initial state, with no props applied beyond the defaults.
  • Requires Tailwind, and the design tokens the classes reference (bg-card, text-muted-foreground, and so on). The template ZIPs ship a globals.css that defines them.

What each framework gets across the whole catalog — effects convert properly; this rung is markup.

For AI

The component, its props, the design tokens it expects and the command that installs it — as one prompt. Paste it into Claude, Cursor, v0 or ChatGPT and what they build around it will match the rest of the catalog instead of inventing its own system.

See the prompt

Used in these pages

Want the whole screen instead of this one section? Open a page and copy it entire.

7 more blocks in Empty & Error States

All of them free to read, copy and install — no account, no locked tiles, no watermarked preview. The whole catalog is open, and so are the API and the CLI.

Browse Empty & Error States

Shipping one commercially

Copying the code is free. Putting it in client work or a paid product is what Pro is for — the licence, not the access.

  • A commercial licence for everything in the catalog
  • Unlimited bundle exports, in Vue, Svelte and Tailwind
  • One payment — no subscription, nothing to renew
Pro — $79 once

More Empty & Error States blocks

View category
Open the full page for this block

Error State With Retry

Failed-to-load panel with a visible retry, a copyable error reference and the stack tucked behind a disclosure.

Empty & Error States131 lines1 dep
Open the full page for this block

404 With Search & Suggestions

A 404 that helps: a real GET search form that works without JavaScript, likely destinations, and home as the fallback rather than the headline.

Empty & Error States146 lines1 dep
Open the full page for this block

Shimmer Skeleton List

Loading placeholders with varied row widths and a sweep that is motion-safe only, falling back to a flat tint under reduced motion.

Empty & Error States88 linesNo deps
Open the full page for this block

Permission Denied (403)

The state where the page exists and the account is not on the list: names who can grant access, sends the request, and leaks nothing about what is inside.

Empty & Error States175 lines1 dep
Open the full page for this block

Offline With Queued Changes

Leads with what still works — three edits saved on this device — instead of with the failure. The retry backoff counts down in the open, and the three things that genuinely cannot work offline are named rather than discovered.

Empty & Error States173 lines1 dep
Open the full page for this block

Empty Because of Filters

The empty state for a list emptied by its own filters: every active filter shown as a removable chip ordered by how many results it would restore, with clear-all deliberately second.

Empty & Error States186 lines1 dep
Open the full page for this block

Scheduled Maintenance Window

Planned downtime with a live countdown, an end time in the reader’s timezone, what still works — and a different sentence once the window overruns rather than a negative timer.

Empty & Error States228 lines1 dep