DisplayNew
Empty
A placeholder for lists and pages with nothing to show yet.
LiveRev. 01
No projects yet
Create your first project to start collecting feedback.
Installation
CLI
$ npx shadcn@latest add https://konsa.rohitxyz.me/r/empty.jsonManual
Copy the source into your project
components/ui/empty.tsx
import * as React from "react";
import { cn } from "@/lib/utils";
function Empty({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="empty"
className={cn(
"flex min-w-0 flex-1 flex-col items-center justify-center gap-5 rounded-xl border border-dashed p-8 text-center text-balance",
className,
)}
{...props}
/>
);
}
function EmptyIcon({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="empty-icon"
className={cn(
"flex size-10 items-center justify-center rounded-lg border bg-card text-muted-foreground shadow-xs [&_svg]:size-5",
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-1.5", className)}
{...props}
/>
);
}
function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="empty-title"
className={cn("font-medium tracking-tight", className)}
{...props}
/>
);
}
function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) {
return (
<p
data-slot="empty-description"
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
);
}
function EmptyActions({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="empty-actions"
className={cn("flex items-center gap-2", className)}
{...props}
/>
);
}
export {
Empty,
EmptyIcon,
EmptyHeader,
EmptyTitle,
EmptyDescription,
EmptyActions,
};Update the import paths to match your project
The file imports cn from @/lib/utils. See installation.
Usage
import { Empty, EmptyIcon, EmptyHeader, EmptyTitle, EmptyDescription, EmptyActions } from "@/components/ui/empty";<Empty>
<EmptyIcon><InboxIcon /></EmptyIcon>
<EmptyHeader>
<EmptyTitle>No messages</EmptyTitle>
<EmptyDescription>New messages will appear here.</EmptyDescription>
</EmptyHeader>
</Empty>