Empty states set
Three empty states (no projects, no search results, all caught up) with small code-drawn illustrations that animate, and one clear action each.
"use client";
import { useState, type ReactElement } from "react";
import "./empty-states.css";
type Kind = "projects" | "search" | "inbox";
/* Small SVG illustrations drawn in code, so there are no image files to manage. */
const ART: Record<Kind, ReactElement> = {
projects: (
<svg viewBox="0 0 160 120" className="gu-empty__art" aria-hidden="true">
<rect
x="30"
y="34"
width="100"
height="70"
rx="10"
className="gu-empty__back"
/>
<rect
x="22"
y="44"
width="116"
height="66"
rx="10"
className="gu-empty__front"
/>
<path
d="M22 54a10 10 0 0 1 10-10h28l8 8h60a10 10 0 0 1 10 10"
className="gu-empty__tab"
/>
<g className="gu-empty__plus">
<circle cx="80" cy="78" r="15" />
<path d="M80 71v14M73 78h14" />
</g>
</svg>
),
search: (
<svg viewBox="0 0 160 120" className="gu-empty__art" aria-hidden="true">
<g className="gu-empty__glass">
<circle cx="72" cy="56" r="28" className="gu-empty__lens" />
<path d="m92 76 20 20" className="gu-empty__handle" />
<path
d="M62 50h.01M82 50h.01M64 66q8-6 16 0"
className="gu-empty__face"
/>
</g>
</svg>
),
inbox: (
<svg viewBox="0 0 160 120" className="gu-empty__art" aria-hidden="true">
<path
d="M30 70l14-34h72l14 34v26a8 8 0 0 1-8 8H38a8 8 0 0 1-8-8z"
className="gu-empty__front"
/>
<path d="M30 70h30l6 10h28l6-10h30" className="gu-empty__tab" />
<g className="gu-empty__sparks">
<path d="M80 16v10M60 22l5 7M100 22l-5 7" />
</g>
</svg>
),
};
const COPY: Record<
Kind,
{
tab: string;
title: string;
text: string;
action: string;
secondary?: string;
}
> = {
projects: {
tab: "No projects",
title: "Start your first project",
text: "Projects keep your pages, files and teammates together. Import from Figma or start blank.",
action: "New project",
secondary: "Import from Figma",
},
search: {
tab: "No results",
title: "No results for “quarterly plann”",
text: "Check the spelling or try a shorter word. Search covers titles, comments and file names.",
action: "Clear search",
secondary: "Search all workspaces",
},
inbox: {
tab: "Inbox zero",
title: "You’re all caught up",
text: "No new mentions or requests. We’ll tell you when something needs you.",
action: "See earlier activity",
},
};
/** EmptyStates: one card shows an empty state; the switch above flips between three examples. */
export function EmptyStates({ theme = "light" }: { theme?: "light" | "dark" }) {
const [kind, setKind] = useState<Kind>("projects");
const c = COPY[kind];
return (
<div className="gu-empty" data-theme={theme}>
<div className="gu-empty__tabs" role="group" aria-label="Example">
{(Object.keys(COPY) as Kind[]).map((k) => (
<button
key={k}
type="button"
aria-pressed={kind === k}
onClick={() => setKind(k)}
>
{COPY[k].tab}
</button>
))}
</div>
<section className="gu-empty__card" key={kind} aria-live="polite">
{ART[kind]}
<h3>{c.title}</h3>
<p>{c.text}</p>
<div className="gu-empty__actions">
<button type="button" className="gu-empty__primary">
{c.action}
</button>
{c.secondary && (
<button type="button" className="gu-empty__secondary">
{c.secondary}
</button>
)}
</div>
</section>
</div>
);
}
Paste this into ChatGPT, Claude, Cursor, v0, Lovable or Bolt. It describes the layout, motion, colors and accessibility and includes the code, so the AI can rebuild it in any framework.
# Build this UI piece: Empty states set
You are a senior front-end engineer. Recreate the piece below in my project. If I don't say which framework I use, ask once, then build it in that framework (React, Vue, Svelte, Angular, Astro, plain HTML/CSS/JS or anything else). Keep the behavior, motion, colors, spacing and accessibility exactly as described. Keep the code clean and commented for beginners.
## What it is
A set of three empty states (no projects yet, no search results, inbox zero) shown one at a time in a dashed card, each with a small animated code-drawn illustration, a helpful title and text, and a clear primary action.
## Layout and look
- Segmented switch above (44px pills; active Ink).
- Card: 460px max, dashed 1.5px border, radius 28px, centered content, padding 32px.
- Illustrations (160px SVG, 2.5px Ink outlines on a soft fill): a folder with an orange "+" bubble that bobs; a magnifier with a puzzled face and an orange handle that searches left and right; an inbox tray with orange sparkles that twinkle.
- Title 22px weight 900; muted text max 34ch; buttons: orange primary pill and an outline secondary, both 48px.
## Behavior and motion
1. Switching examples re-mounts the card with a 10px fade-up (500ms cubic-bezier(0.16, 1, 0.3, 1)).
2. Each illustration has one gentle looping motion (2–3s, ease-in-out).
## Writing
Say what is empty and what to do next. For search, echo the query and suggest a fix. For inbox zero, reassure and offer a way back to history.
## Accessibility
- The switch uses aria-pressed; the card is aria-live="polite"; illustrations are aria-hidden.
- prefers-reduced-motion: still illustrations.
## Props
theme. Edit COPY and ART.
## Reference implementation
The original is written in React with one plain CSS file. Dependencies: none (plain React and CSS). Translate it faithfully; do not add new libraries unless my framework needs them.
### EmptyStates.tsx
```tsx
"use client";
import { useState, type ReactElement } from "react";
import "./empty-states.css";
type Kind = "projects" | "search" | "inbox";
/* Small SVG illustrations drawn in code, so there are no image files to manage. */
const ART: Record<Kind, ReactElement> = {
projects: (
<svg viewBox="0 0 160 120" className="gu-empty__art" aria-hidden="true">
<rect
x="30"
y="34"
width="100"
height="70"
rx="10"
className="gu-empty__back"
/>
<rect
x="22"
y="44"
width="116"
height="66"
rx="10"
className="gu-empty__front"
/>
<path
d="M22 54a10 10 0 0 1 10-10h28l8 8h60a10 10 0 0 1 10 10"
className="gu-empty__tab"
/>
<g className="gu-empty__plus">
<circle cx="80" cy="78" r="15" />
<path d="M80 71v14M73 78h14" />
</g>
</svg>
),
search: (
<svg viewBox="0 0 160 120" className="gu-empty__art" aria-hidden="true">
<g className="gu-empty__glass">
<circle cx="72" cy="56" r="28" className="gu-empty__lens" />
<path d="m92 76 20 20" className="gu-empty__handle" />
<path
d="M62 50h.01M82 50h.01M64 66q8-6 16 0"
className="gu-empty__face"
/>
</g>
</svg>
),
inbox: (
<svg viewBox="0 0 160 120" className="gu-empty__art" aria-hidden="true">
<path
d="M30 70l14-34h72l14 34v26a8 8 0 0 1-8 8H38a8 8 0 0 1-8-8z"
className="gu-empty__front"
/>
<path d="M30 70h30l6 10h28l6-10h30" className="gu-empty__tab" />
<g className="gu-empty__sparks">
<path d="M80 16v10M60 22l5 7M100 22l-5 7" />
</g>
</svg>
),
};
const COPY: Record<
Kind,
{
tab: string;
title: string;
text: string;
action: string;
secondary?: string;
}
> = {
projects: {
tab: "No projects",
title: "Start your first project",
text: "Projects keep your pages, files and teammates together. Import from Figma or start blank.",
action: "New project",
secondary: "Import from Figma",
},
search: {
tab: "No results",
title: "No results for “quarterly plann”",
text: "Check the spelling or try a shorter word. Search covers titles, comments and file names.",
action: "Clear search",
secondary: "Search all workspaces",
},
inbox: {
tab: "Inbox zero",
title: "You’re all caught up",
text: "No new mentions or requests. We’ll tell you when something needs you.",
action: "See earlier activity",
},
};
/** EmptyStates: one card shows an empty state; the switch above flips between three examples. */
export function EmptyStates({ theme = "light" }: { theme?: "light" | "dark" }) {
const [kind, setKind] = useState<Kind>("projects");
const c = COPY[kind];
return (
<div className="gu-empty" data-theme={theme}>
<div className="gu-empty__tabs" role="group" aria-label="Example">
{(Object.keys(COPY) as Kind[]).map((k) => (
<button
key={k}
type="button"
aria-pressed={kind === k}
onClick={() => setKind(k)}
>
{COPY[k].tab}
</button>
))}
</div>
<section className="gu-empty__card" key={kind} aria-live="polite">
{ART[kind]}
<h3>{c.title}</h3>
<p>{c.text}</p>
<div className="gu-empty__actions">
<button type="button" className="gu-empty__primary">
{c.action}
</button>
{c.secondary && (
<button type="button" className="gu-empty__secondary">
{c.secondary}
</button>
)}
</div>
</section>
</div>
);
}
```
### empty-states.css
```css
/* EmptyStates: change these colors to match your brand. */
.gu-empty {
--card: #fbf8f2;
--text: #0e0e10;
--muted: #57534b;
--line: rgb(14 14 16 / 0.14);
--soft: rgb(14 14 16 / 0.06);
--accent: #ff5a1f;
--focus: #2b35ff;
--ease: cubic-bezier(0.16, 1, 0.3, 1);
display: grid;
justify-items: center;
gap: 16px;
width: min(100%, 460px);
color: var(--text);
font-family: system-ui, sans-serif;
}
.gu-empty[data-theme="dark"] {
--card: #18181b;
--text: #f3eee3;
--muted: #aea89c;
--line: rgb(243 238 227 / 0.14);
--soft: rgb(243 238 227 / 0.07);
--focus: #d7ff3a;
}
.gu-empty button {
font: inherit;
cursor: pointer;
}
.gu-empty button:focus-visible {
outline: 3px solid var(--focus);
outline-offset: 2px;
}
.gu-empty__tabs {
display: inline-flex;
padding: 4px;
border: 1px solid var(--line);
border-radius: 999px;
}
.gu-empty__tabs button {
min-height: 44px;
padding: 0 14px;
border: 0;
border-radius: 999px;
background: none;
color: var(--muted);
font-size: 0.85rem;
font-weight: 700;
}
.gu-empty__tabs [aria-pressed="true"] {
background: var(--text);
color: var(--card);
}
.gu-empty__card {
display: grid;
justify-items: center;
gap: 8px;
width: 100%;
padding: 32px 28px;
border: 1.5px dashed var(--line);
border-radius: 28px;
background: var(--card);
text-align: center;
animation: gu-empty-in 0.5s var(--ease);
}
@keyframes gu-empty-in {
from {
opacity: 0;
transform: translateY(10px);
}
}
.gu-empty__art {
width: 160px;
margin-bottom: 6px;
overflow: visible;
fill: none;
stroke-linecap: round;
stroke-linejoin: round;
}
.gu-empty__back {
fill: var(--soft);
}
.gu-empty__front {
fill: var(--soft);
stroke: var(--text);
stroke-width: 2.5;
}
.gu-empty__tab {
stroke: var(--text);
stroke-width: 2.5;
}
.gu-empty__plus circle {
fill: var(--accent);
}
.gu-empty__plus path {
stroke: #0e0e10;
stroke-width: 3;
}
.gu-empty__plus {
transform-origin: 80px 78px;
animation: gu-empty-bob 2.4s ease-in-out infinite;
}
@keyframes gu-empty-bob {
50% {
transform: translateY(-5px) scale(1.06);
}
}
.gu-empty__lens {
fill: var(--soft);
stroke: var(--text);
stroke-width: 3;
}
.gu-empty__handle {
stroke: var(--accent);
stroke-width: 9;
}
.gu-empty__face {
stroke: var(--text);
stroke-width: 3.5;
}
.gu-empty__glass {
transform-origin: 72px 56px;
animation: gu-empty-search 3s ease-in-out infinite;
}
@keyframes gu-empty-search {
25% {
transform: translate(-10px, 2px) rotate(-6deg);
}
75% {
transform: translate(10px, -2px) rotate(6deg);
}
}
.gu-empty__sparks path {
stroke: var(--accent);
stroke-width: 3.5;
}
.gu-empty__sparks {
animation: gu-empty-twinkle 1.8s ease-in-out infinite;
}
@keyframes gu-empty-twinkle {
50% {
opacity: 0.3;
transform: translateY(-3px);
}
}
.gu-empty__card h3 {
margin: 0;
font-size: 1.35rem;
font-weight: 900;
letter-spacing: -0.03em;
}
.gu-empty__card p {
max-width: 34ch;
margin: 0 0 10px;
color: var(--muted);
line-height: 1.5;
}
.gu-empty__actions {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 8px;
}
.gu-empty__actions button {
min-height: 48px;
padding: 0 20px;
border-radius: 999px;
font-weight: 800;
}
.gu-empty__primary {
border: 0;
background: var(--accent);
color: #0e0e10;
}
.gu-empty__secondary {
border: 1.5px solid var(--line);
background: none;
color: inherit;
}
.gu-empty__secondary:hover {
border-color: var(--text);
}
@media (prefers-reduced-motion: reduce) {
.gu-empty__card,
.gu-empty__plus,
.gu-empty__glass,
.gu-empty__sparks {
animation: none;
}
}
```
You might also want
Next piece: Event ticketEvent ticket
Components, intermediate
3D tilt card
Components, intermediate
Copy field
Components, beginner