Overview
TheEmptyState component displays a centered message when there’s no content to show. It’s commonly used in lists, tables, and search results to guide users on what to do next.
Basic Usage
With Action Button
Use thechildren snippet to add a call-to-action button:
With Check Badge
Add a check badge overlay to indicate completion or success:Custom Icon with Snippet
For complete control over the icon area, use theicon snippet:
Search Results Empty State
Multiple Actions
Props
Custom Svelte snippet for the icon area. Provides complete control over the icon design and layout.
Icon from
@steeze-ui/svelte-icon compatible library. Displayed with the default empty state styling.The main heading text, typically describing the empty state (e.g., “No items found”).
Secondary text providing context or suggesting next steps.
When
true and using iconSource, displays a check badge overlay on the icon. Useful for success or completion states.Svelte snippet for action buttons or additional content below the description.
Icon Options
You have two ways to provide an icon:-
iconSource (recommended): Use any
@steeze-ui/svelte-iconcompatible icon. This automatically includes the default styling with the icon container. - icon snippet: Provide your own custom SVG or component for complete control over the appearance.
Only use one icon method at a time. If both
icon and iconSource are provided, the icon snippet takes precedence.Layout
The component uses a centered flex layout:- Icon: 120px height, 352px max width container
- Text: Centered alignment with 0.5rem gap between title and description
- Actions: 1rem top margin (when using
childrensnippet)
Styling
Default Icon Styling
When usingiconSource:
- Icon size: 40px (size-10)
- Icon color:
text-icon-accent - Container: Relative positioned with IconEmpty background component
- Check badge: Absolute positioned overlay (when
check={true})
Typography
- Title:
text-base,font-medium,text-foreground - Description:
text-base,text-foreground-default-secondary
Use Cases
- Empty lists or tables: “No invoices found”
- Search with no results: “No results for your query”
- Filtered data with no matches: “No items match your filters”
- Onboarding states: “Welcome! Create your first project”
- Success states: “All done! No pending items”
- Error recovery: “Something went wrong. Try again”
Accessibility
- Semantic HTML with proper heading hierarchy (h4 for title)
- Centered layout ensures visibility
- Action buttons receive proper focus styling
- Icon is decorative and doesn’t interfere with screen readers
TypeScript
The component is fully typed with theEmptyStateProps interface:
Related Components
- BaseCard - For empty state within cards
- Notification - For temporary feedback messages
- BaseButton - For action buttons in empty states