Empty State
<EmptyState>TailwindCSS ModulesEmpty states explain why a collection has no content and help people take the next step. Combine a clear title, supporting description, optional icon, and a focused action for first-use screens, filtered results, and quiet inboxes.
npx coloxo add empty-state --style coloxo-cssimport { EmptyState } from '@coloxo/ui';Design Tokens:
1. Empty state patterns
Use specific copy to distinguish a new collection, an unsuccessful search, and a completed task.
First use
Create your first project to organize your team's work.
No results
Try a different search term or clear your filters.
All caught up
New notifications will appear here when there is an update.
2. Actions & composition
Use actionLabel with onAction for a built-in small primary button, or supply action for custom controls. A custom action takes precedence over actionLabel.
Simple action
Custom action slot
Invite teammates or import an existing directory.
3. Interactive Props Configurator
Create your first project to organize your team's work.
<EmptyState icon={<FolderOpen />} title="No projects yet" description="Create your first project to organize your team's work." actionLabel="Create project" onAction={handleAction}/>4. Dark theme
Semantic tokens adapt the icon, title, description, and actions to dark surfaces.
First useYour workspace is ready for its first project.
All caught upThere are no unread notifications right now.
5. Enterprise layout compositions
Keep the surrounding context visible and make the recovery action useful. Try these local demos to see content replace an empty state.
Bring tasks, files, and teammates together in one place.
No team members match the current filters. Clear them to see everyone.
Accessibility
Explain the empty state in the title and description. Decorative icons should not be the only way to understand the message.
The built-in action is a native button that supports Tab, Enter, and Space. Use accessible buttons or links in custom action slots.
EmptyState does not add a live region or heading role automatically. Announce asynchronous results in an appropriate status region and add heading semantics when needed.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| title | ReactNode | — | Required title explaining the empty state. |
| description | ReactNode | — | Supporting text rendered in a paragraph below the title. |
| icon | ReactNode | — | Optional icon rendered in a 48px circular container. |
| actionLabel | string | — | Label for the built-in small primary action button. |
| onAction | () => void | — | Click handler for the built-in action button. |
| action | ReactNode | — | Custom action slot. Takes precedence over the built-in action when non-nullish. |
| className | string | — | Additional classes on the root div. Other HTML div attributes are forwarded to the root. |