Styled empty state
Five empty-state placeholders: simple, icon, illustration, action and card. Each is sized, token-driven and centers an icon, a title, a description and an optional action.
Installation
The styled layer is free and installs like any other ai2 component.
Run the following command
npx shadcn@latest add @ai2/empty-styledDependencies, the @ai2/tokens theme and the component file are installed together.
Install dependencies
npm install lucide-reactCopy the source
components/ui/empty-styled.tsx"use client"
import type * as React from "react"
import { FileX, FolderOpen, Inbox, Plus, Search } from "lucide-react"
import { cn } from "@/lib/utils"
/* Styled empty family: 5 opt-in empty-state placeholders. Each is a centred column: an icon or illustration plus title plus description plus an optional action. Colour comes ONLY from semantic tokens (transparency via color-mix), size = the padding plus icon and text scale. Renders without props too: the title, description and a default token icon come filled in. */
export type StyledSize = "sm" | "md" | "lg" | "xl"
type Scale = {
root: string
icon: string
badge: string
title: string
description: string
}
const scales: Record<StyledSize, Scale> = {
sm: {
root: "gap-2 p-6",
icon: "size-6",
badge: "size-12",
title: "text-sm",
description: "text-xs",
},
md: {
root: "gap-3 p-8",
icon: "size-8",
badge: "size-16",
title: "text-base",
description: "text-sm",
},
lg: {
root: "gap-3.5 p-10",
icon: "size-10",
badge: "size-20",
title: "text-lg",
description: "text-sm",
},
xl: {
root: "gap-4 p-12",
icon: "size-12",
badge: "size-24",
title: "text-xl",
description: "text-base",
},
}
type EmptyProps = {
className?: string
size?: StyledSize
icon?: React.ReactNode
title?: React.ReactNode
description?: React.ReactNode
action?: React.ReactNode
}
/* SimpleEmpty: a plain token icon + title + description, with no frame at all. */
export function SimpleEmpty({
className,
size = "md",
icon,
title = "No results found",
description = "Try adjusting your search or filters to find what you are looking for.",
action,
}: EmptyProps) {
const s = scales[size]
return (
<div
data-slot="styled-empty"
className={cn(
"flex flex-col items-center justify-center text-center",
s.root,
className
)}
>
<span
aria-hidden="true"
className={cn(
"text-muted-foreground [&_i]:leading-none [&_svg]:size-full",
s.icon
)}
>
{icon ?? <Search />}
</span>
<p className={cn("font-semibold text-foreground", s.title)}>{title}</p>
{description ? (
<p className={cn("max-w-prose text-muted-foreground", s.description)}>
{description}
</p>
) : null}
{action ? <div className="mt-2">{action}</div> : null}
</div>
)
}
/* IconEmpty: token ikon, metnin ustunde yumusak token daire rozet icinde. */
export function IconEmpty({
className,
size = "md",
icon,
title = "Your inbox is empty",
description = "New messages will show up here as soon as they arrive.",
action,
}: EmptyProps) {
const s = scales[size]
return (
<div
data-slot="styled-empty"
className={cn(
"flex flex-col items-center justify-center text-center",
s.root,
className
)}
>
<span
aria-hidden="true"
className={cn(
"flex items-center justify-center rounded-full border border-border text-muted-foreground [background:color-mix(in_oklab,var(--color-foreground)_6%,transparent)]",
s.badge
)}
>
<span className={cn("[&_i]:leading-none [&_svg]:size-full", s.icon)}>
{icon ?? <Inbox />}
</span>
</span>
<p className={cn("font-semibold text-foreground", s.title)}>{title}</p>
{description ? (
<p className={cn("max-w-prose text-muted-foreground", s.description)}>
{description}
</p>
) : null}
{action ? <div className="mt-2">{action}</div> : null}
</div>
)
}
/* IllustrationEmpty: a geometric blob illustration built from token divs and SVG shapes above the text. When an icon prop is given it sits in the centre of the blob. */
export function IllustrationEmpty({
className,
size = "md",
icon,
title = "Nothing here yet",
description = "This space is ready for your first item. Create one to get started.",
action,
}: EmptyProps) {
const s = scales[size]
return (
<div
data-slot="styled-empty"
className={cn(
"flex flex-col items-center justify-center text-center",
s.root,
className
)}
>
<div aria-hidden="true" className={cn("relative", s.badge)}>
<div className="absolute inset-0 rounded-[42%_58%_58%_42%/48%_42%_58%_52%] [background:color-mix(in_oklab,var(--color-primary)_16%,transparent)]" />
<div className="absolute inset-[18%] rounded-[58%_42%_45%_55%/52%_55%_45%_48%] [background:color-mix(in_oklab,var(--color-foreground)_8%,transparent)]" />
<div className="absolute inset-0 grid place-items-center">
<span
className={cn(
"text-foreground/70 [&_i]:leading-none [&_svg]:size-full",
s.icon
)}
>
{icon ?? <FolderOpen />}
</span>
</div>
</div>
<p className={cn("font-semibold text-foreground", s.title)}>{title}</p>
{description ? (
<p className={cn("max-w-prose text-muted-foreground", s.description)}>
{description}
</p>
) : null}
{action ? <div className="mt-2">{action}</div> : null}
</div>
)
}
/* ActionEmpty: title plus description plus a token primary action button ("Create new"). When no action prop is given the default button renders. */
export function ActionEmpty({
className,
size = "md",
icon,
title = "No projects yet",
description = "Get started by creating your first project.",
action,
}: EmptyProps) {
const s = scales[size]
return (
<div
data-slot="styled-empty"
className={cn(
"flex flex-col items-center justify-center text-center",
s.root,
className
)}
>
<span
aria-hidden="true"
className={cn(
"text-muted-foreground [&_i]:leading-none [&_svg]:size-full",
s.icon
)}
>
{icon ?? <FileX />}
</span>
<p className={cn("font-semibold text-foreground", s.title)}>{title}</p>
{description ? (
<p className={cn("max-w-prose text-muted-foreground", s.description)}>
{description}
</p>
) : null}
<div className="mt-2">
{action ?? (
<button
type="button"
data-slot="styled-empty-action"
className="inline-flex h-9 items-center justify-center gap-2 rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors duration-(--motion-base) ease-(--motion-ease) hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 motion-reduce:transition-none [&_i]:text-base [&_i]:leading-none [&_svg]:size-4"
>
<Plus />
Create new
</button>
)}
</div>
</div>
)
}
/* CardEmpty: the empty state sits inside a card surface with a dashed token
border. */
export function CardEmpty({
className,
size = "md",
icon,
title = "No files uploaded",
description = "Drag and drop files here, or use the button to add your first one.",
action,
}: EmptyProps) {
const s = scales[size]
return (
<div
data-slot="styled-empty"
className={cn(
"flex flex-col items-center justify-center rounded-xl border border-dashed border-border bg-card text-center text-card-foreground [background:color-mix(in_oklab,var(--color-foreground)_3%,var(--color-card))]",
s.root,
className
)}
>
<span
aria-hidden="true"
className={cn(
"text-muted-foreground [&_i]:leading-none [&_svg]:size-full",
s.icon
)}
>
{icon ?? <Inbox />}
</span>
<p className={cn("font-semibold text-foreground", s.title)}>{title}</p>
{description ? (
<p className={cn("max-w-prose text-muted-foreground", s.description)}>
{description}
</p>
) : null}
{action ? <div className="mt-2">{action}</div> : null}
</div>
)
}Manual installs skip the @ai2/tokens theme, so add the token CSS from the theming guide or the tone colors will be missing.
Variations
5 takes on the same idea. Each is its own export, and every one accepts a size prop (sm, md, lg, xl) aligned to the base Button scale.
Simple
A muted icon with a title and description.
No results found
Try adjusting your search or filters to find what you are looking for.
import { SimpleEmpty } from "@/components/ui/empty-styled"
<SimpleEmpty />No results found
Try adjusting your search or filters to find what you are looking for.
No results found
Try adjusting your search or filters to find what you are looking for.
No results found
Try adjusting your search or filters to find what you are looking for.
No results found
Try adjusting your search or filters to find what you are looking for.
Icon
A token icon inside a soft-token circle badge.
Your inbox is empty
New messages will show up here as soon as they arrive.
import { IconEmpty } from "@/components/ui/empty-styled"
<IconEmpty />Your inbox is empty
New messages will show up here as soon as they arrive.
Your inbox is empty
New messages will show up here as soon as they arrive.
Your inbox is empty
New messages will show up here as soon as they arrive.
Your inbox is empty
New messages will show up here as soon as they arrive.
Illustration
A token illustration above the text.
Nothing here yet
This space is ready for your first item. Create one to get started.
import { IllustrationEmpty } from "@/components/ui/empty-styled"
<IllustrationEmpty />Nothing here yet
This space is ready for your first item. Create one to get started.
Nothing here yet
This space is ready for your first item. Create one to get started.
Nothing here yet
This space is ready for your first item. Create one to get started.
Nothing here yet
This space is ready for your first item. Create one to get started.
Action
A title, description and a primary action.
No projects yet
Get started by creating your first project.
import { ActionEmpty } from "@/components/ui/empty-styled"
<ActionEmpty />No projects yet
Get started by creating your first project.
No projects yet
Get started by creating your first project.
No projects yet
Get started by creating your first project.
No projects yet
Get started by creating your first project.
Card
The empty state sits inside a dashed token card.
No files uploaded
Drag and drop files here, or use the button to add your first one.
import { CardEmpty } from "@/components/ui/empty-styled"
<CardEmpty />No files uploaded
Drag and drop files here, or use the button to add your first one.
No files uploaded
Drag and drop files here, or use the button to add your first one.
No files uploaded
Drag and drop files here, or use the button to add your first one.
No files uploaded
Drag and drop files here, or use the button to add your first one.
ai2 Styled empty state: 5 styled variations on the token system
The ai2 Styled empty state are a set of 5 decorative button variations from the styled layer of the @ai2 design system, built around empty-state placeholders. They are free and MIT licensed, and every color comes from a semantic token, so they theme with the rest of ai2 in light and dark.
Motion runs on framer-motion: these are static; no motion library work is required. The styled layer is opt-in, so the dependency only lands if you use it; the base components stay lean. Under reduced motion, there is no motion to reduce.
What is in the ai2 Styled empty state?
5 exports in one file: Simple, Icon, Illustration, Action and Card. Each renders a native button and takes a size prop (sm, md, lg, xl) aligned to the base Button. They are separate from the base Button on purpose: the base keeps its clean variant, tone and size axes, while the styled layer carries the effects.
You own the file. Copy the one category file and you have all 5 variations, with no runtime dependency on ai2 itself.
Why use it
- On-system by construction: Every color resolves to an ai2 semantic token, so the buttons follow your theme in light and dark with no extra work.
- Effect without the sprawl: The decorations live in a dedicated styled file, so the base Button keeps its clean, predictable API.
- Accessible and honest: Each renders a real button element, keeps a visible focus ring, and respects prefers-reduced-motion.
Features
- Token-driven color: No hardcoded hex or oklch; the look recolors with your theme tokens.
- framer-motion: these are static; no motion library work is required.
- Reduced-motion aware: Under prefers-reduced-motion, there is no motion to reduce.
- Size aligned to the base: Every variation takes sm, md, lg and xl matching the base Button height scale, so styled and base buttons line up in a row.
Production tips
- Use it for emphasis, not everywhere: Styled buttons draw the eye. Reserve them for the one action you want people to take on a screen, and use the base Button for the rest.
- Keep labels as verbs: The decoration adds weight, so a clear action label keeps the button scannable.
- Pick one variation per surface: The variations share a family; using two different ones in the same view competes for attention.
Works with the rest of ai2
The Styled empty state sit alongside the base Button and the rest of the @ai2 registry. They share the same token file, so a styled action next to a base button or a badge stays visually consistent in both modes.