EmptyState
Shared ComponentsPlaceholder display for empty data states with icon, title, description, and optional action button.
Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.
"use client";
import { EmptyState } from "@dashboardpack/core/components/shared/empty-state";
import { Button } from "@dashboardpack/core/components/ui/button";
import { FolderPlus } from "lucide-react";
import { useState } from "react";
export default function EmptyStateExample() {
const [created, setCreated] = useState(false);
return (
<div className="w-full">
<EmptyState
icon={<FolderPlus />}
title={created ? "Your first project is ready" : "No projects yet"}
description={
created
? "You can now invite teammates and add tasks."
: "Create your first project to start organizing your work."
}
action={
<Button
variant={created ? "outline" : "default"}
onClick={() => setCreated(!created)}
>
{created ? "Reset example" : "Create project"}
</Button>
}
/>
</div>
);
}Usage
Explain why a section is empty and provide a useful next action. Use different wording for a new workspace and an unmatched search.
import { EmptyState } from "@dashboardpack/core/components/shared/empty-state";Available in the included @dashboardpack/core package. Copy the complete example from Source code for all imports and state. Add "use client" when using hooks or event handlers. See installation and theming for project setup.
API reference
Common props and defaults. Slot-specific props are named below; native elements also accept their standard HTML attributes. The component TypeScript definitions are the complete type reference.
| Prop | Type / Default | Description |
|---|---|---|
| title | stringDefault: required | Primary empty-state message. |
| description | stringDefault: — | Context and suggested next step. |
| icon | ReactNodeDefault: — | Optional decorative illustration or icon. |
| action | ReactNodeDefault: — | Optional button or link. |
| className | stringDefault: — | Extend container spacing. |