shadcn.io is not affiliated with official shadcn/ui
No Projects Yet
You haven't created any projects yet. Get started by creating your first project.
Installation
bunx --bun shadcn@latest add https://kit.dev/r/base/empty.jsonnpx shadcn@latest add https://kit.dev/r/base/empty.jsonpnpm dlx shadcn@latest add https://kit.dev/r/base/empty.jsonyarn shadcn@latest add https://kit.dev/r/base/empty.jsonThis component depends on Button, Avatar, Input Group and Kbd. Install them first if you haven't already.
Install the following dependencies:
bun add tailwind-variantsnpm install tailwind-variantspnpm add tailwind-variantsyarn add tailwind-variantsCopy and paste the following code into your project.
import type React from "react";
import { tv, type VariantProps } from "tailwind-variants";
import { cn } from "@/lib/utils";
export const Empty = (props: React.ComponentProps<"div">) => {
const { className, ...rest } = props;
return (
<div
className={cn(
"cn-empty flex w-full min-w-0 max-w-full flex-1 flex-col items-center justify-center text-balance text-center",
className
)}
data-slot="empty"
{...rest}
/>
);
};Update the import paths to match your project setup.
Usage
import { FolderCodeIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import {
Empty,
EmptyContent,
EmptyDescription,
EmptyHeader,
EmptyMedia,
EmptyTitle,
} from "@/components/ui/empty";<Empty>
<EmptyHeader>
<EmptyMedia variant="icon">
<FolderCodeIcon aria-hidden="true" />
</EmptyMedia>
<EmptyTitle>No Projects Yet</EmptyTitle>
<EmptyDescription>
You haven't created any projects yet.
</EmptyDescription>
</EmptyHeader>
<EmptyContent>
<Button>Create Project</Button>
</EmptyContent>
</Empty>Demos
Outline
Use a dashed border for an outlined empty state.
Background
Use background utilities on Empty.
Avatar
Use EmptyMedia with an avatar.
Avatar Group
Use EmptyMedia with an avatar group.
Input Group
Add an InputGroup inside EmptyContent.
Card
Empty state with linked actions.
Rtl
Right-to-left empty. See the RTL configuration guide for document direction.
API Reference
Empty
PropType
AttributeType
EmptyHeader
PropType
AttributeType
EmptyMedia
PropType
AttributeType
EmptyTitle
PropType
AttributeType
EmptyDescription
PropType
AttributeType
EmptyContent
PropType
AttributeType