Empty
Empty states arrive part by part: the icon tile pops and its strokes draw, then the title, the description and each action rise in out of a blur.
See it as an AI agent does.See this component the way an AI agent does.
Installation
npx shadcn@latest add @keyframery/emptyThis adds components/keyframery/empty.tsx and its primitive to your project, and installs UI SDK, along with agent-content, which it builds on. The motion tokens are added to your global CSS the first time you install a component.
Usage
import { Inbox } from "lucide-react"
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/keyframery/empty"
export default function Usage() {
return (
<Empty>
<EmptyHeader>
<EmptyMedia variant="icon">
<Inbox />
</EmptyMedia>
<EmptyTitle>No messages</EmptyTitle>
<EmptyDescription>New messages will show up here.</EmptyDescription>
</EmptyHeader>
</Empty>
)
}Anatomy
How the parts fit together:
Empty
└── EmptyHeader
├── EmptyMedia
├── EmptyTitle
└── EmptyDescriptionExamples
Basic
The parts arrive in turn: the icon tile pops and its strokes draw, then the title, the description and each action rise in.
After a search
announce reads the title and description to screen readers when the empty state appears, so a search that finds nothing is heard, not only seen.
With pictures
The default EmptyMedia holds anything, like a small stack of photos; each one pops in after the last.
Motion
| Move | What you see |
|---|---|
| Draw | The media pops in from 0.6 and the strokes of the icon inside it draw themselves. |
| Cascade | The title, the description and then each action rise 10px out of a blur, one after another. |
Timing and springiness follow the motion style you set. To change how fast this empty moves, pass speed:
<Empty speed="fast">
…
</Empty>"fast" is 0.6×, "slow" 1.4×, and a number sets the multiplier. With reduced motion turned on, nothing moves: changes happen at once or with a short fade.
Theming
Set these CSS variables on the component or a parent. Leave them unset to follow the light and dark theme. The open Customize panel below the preview lets you try these settings.
| Variable | What it changes | Default |
|---|---|---|
--empty-face | Icon surface | bg-background |
--empty-ink | Icon and links | text-foreground |
--empty-muted | Description colour | text-muted-foreground |
--empty-radius | Icon corners | rounded-[13px] |
--empty-font | Title size | text-[15px] |
--empty-gap | Section gap | gap-5 |
--empty-padding | Empty-state padding | p-8 |
--empty-media-size | Icon tile size | size-12 |
API reference
Every part takes className and children, along with the props of the element it renders. The parts are rendered by UI SDK, so they also take render, to draw your own element, and a function of their state for className and style.
Empty
Renders a <div>, and takes its props too.
Prop
Type
EmptyMedia
Renders a <div>, and takes its props too.
Prop
Type
Other parts
These take the props of the element they render, and nothing else:
EmptyHeader: a<div>EmptyTitle: a<div>EmptyDescription: a<p>EmptyContent: a<div>
Accessibility
Roles, keyboard and focus are declared on the component's UI SDK primitive, and state is announced through the matching ARIA attributes. More in Accessibility.
Built on UI SDK's core
UI SDK doesn't ship a empty, so this one is defined with its core: one definePrimitive in components/keyframery/core/empty-core.ts, with no React in it. UI SDK's adapters can render that same definition in Vue, Svelte, Solid and web components. To keep your own styling and take only the motion, import from @/components/keyframery/primitives/empty.
Questions
How does the animated Empty for UI SDK move?
Draw: The media pops in from 0.6 and the strokes of the icon inside it draw themselves. Cascade: The title, the description and then each action rise 10px out of a blur, one after another.
Do I need Motion or Framer Motion for the animated Empty?
No. Every move is plain CSS, so there is nothing to install besides the component and UI SDK.
UI SDK has no empty. How is this one built on UI SDK?
Its behaviour is one definition written with UI SDK's core (definePrimitive), in components/keyframery/core/empty-core.ts. Its parts are rendered by UI SDK's adapter, so they take render, state-based class names and data-slot, like every UI SDK component.
What happens to the Empty when someone turns on reduced motion?
Nothing moves. State changes happen at once, or with a short fade.
More in Feedback
All componentsAlert
Alerts drop into place out of a blur on a spring while their icon pops into its tile and draws, and when dismissed they fade and fold their height away.
Skeleton
A shimmering placeholder that cross-fades to the real content, which rises in out of a blur. While it loads the content is hidden from screen readers and can't be tabbed into.