Communication
Empty state
When there's nothing yet. The icon floats in, the words rise, then the icon takes one slow breath.
Examples and variants
Basic
Icon, title, description and an action.
New messages will show up here.
function EmptyBasic() {
return (
<Empty>
<EmptyHeader>
<EmptyMedia>
<InboxIcon />
</EmptyMedia>
<EmptyTitle>No messages yet</EmptyTitle>
<EmptyDescription>New messages will show up here.</EmptyDescription>
</EmptyHeader>
<EmptyContent>
<Button size="sm">Compose</Button>
</EmptyContent>
</Empty>
)
}Spec drawing
Measured from the live component at default density. Each code maps to the token that sets it; change the token and the drawing follows.
Install
With the CLI
The shadcn CLI only delivers files: it copies our code from the Isotopi registry into your project and installs the packages it uses. Add the foundation once, then the component.
npx shadcn@latest add https://isotopi.com/r/minimal.json
npx shadcn@latest add https://isotopi.com/r/empty.jsonBy hand
No CLI needed. Add the foundation once (see Getting started), then follow these steps. They include every component this one builds on.
Install the packages it uses.
Terminalnpm install cnCopy this file to the same paths in your project. Imports use the
@/alias for your project root.components/ui/empty.tsxempty
components/ui/empty.tsximport * as React from "react" import { cn } from "cn" /* Empty: a placeholder for no content yet. Media floats in, title and description rise after it, then the media takes one slow breath. Hovering the media plays the breath again. */ function Empty({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="empty" className={cn("flex flex-col items-center justify-center gap-stack-md px-6 py-10 text-center", className)} {...props} /> ) } function EmptyHeader({ className, ...props }: React.ComponentProps<"div">) { return <div data-slot="empty-header" className={cn("flex max-w-sm flex-col items-center gap-stack-xs", className)} {...props} /> } function EmptyMedia({ className, ...props }: React.ComponentProps<"div">) { return ( <div data-slot="empty-media" className={cn( "empty-media mb-1 flex size-(--empty-media-size) items-center justify-center rounded-(--empty-media-corner) bg-surface-sunken text-muted-foreground [&_svg]:size-icon-xl", className )} {...props} /> ) } function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) { return <div data-slot="empty-title" className={cn("empty-copy text-title", className)} {...props} /> } function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) { return <p data-slot="empty-description" className={cn("empty-copy text-sm text-muted-foreground", className)} {...props} /> } function EmptyContent({ className, ...props }: React.ComponentProps<"div">) { return <div data-slot="empty-content" className={cn("empty-copy flex items-center gap-inline-sm", className)} {...props} /> } export { Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent }
Imports
What the examples on this page import:
import { InboxIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty"Anatomy
- 1Media · --empty-media-size, --empty-media-corner.
- 2Title and description · Say what will appear and how.
- 3Content · The primary action.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | parts | — | EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent. |
Tokens
Every visual spec is a component token in styles/tokens/components.css, pointing at a semantic token. Change a token to restyle the component; themes change the semantic layer.
| Token | Points to | Light | Dark |
|---|---|---|---|
--empty-media-size | var(--space-12) | 48px | same |
--empty-media-corner | var(--shape-md) | 14px | same |
Motion
| Trigger | What happens | Tokens |
|---|---|---|
| Enter / hover | Floats in, copy rises; one breath; hover breathes again. | --duration-settle, --duration-breath |
Calm keeps the motion without overshoot. Still (and reduced motion) keeps a designed frame with no movement.
Accessibility
- The action is a real Button with a clear label.
Usage
Do
- Offer the next step.
Don’t
- Don't use for loading.
Code
import * as React from "react"
import { cn } from "cn"
/*
Empty: a placeholder for no content yet. Media floats in, title and
description rise after it, then the media takes one slow breath. Hovering
the media plays the breath again.
*/
function Empty({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="empty"
className={cn("flex flex-col items-center justify-center gap-stack-md px-6 py-10 text-center", className)}
{...props}
/>
)
}
function EmptyHeader({ className, ...props }: React.ComponentProps<"div">) {
return <div data-slot="empty-header" className={cn("flex max-w-sm flex-col items-center gap-stack-xs", className)} {...props} />
}
function EmptyMedia({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="empty-media"
className={cn(
"empty-media mb-1 flex size-(--empty-media-size) items-center justify-center rounded-(--empty-media-corner) bg-surface-sunken text-muted-foreground [&_svg]:size-icon-xl",
className
)}
{...props}
/>
)
}
function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) {
return <div data-slot="empty-title" className={cn("empty-copy text-title", className)} {...props} />
}
function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) {
return <p data-slot="empty-description" className={cn("empty-copy text-sm text-muted-foreground", className)} {...props} />
}
function EmptyContent({ className, ...props }: React.ComponentProps<"div">) {
return <div data-slot="empty-content" className={cn("empty-copy flex items-center gap-inline-sm", className)} {...props} />
}
export { Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent }