EmptyState
Centered placeholder for empty views with icon, title, description, and optional action slot. Three sizes control spacing, icon dimensions, and typography.
import { EmptyState, Button } from "phoundry-ui";Basic
Loading interactive example…
View source
<script lang="ts"> import { EmptyState } from "phoundry-ui"; import { PhiIcons } from "phoundry-ui";</script>
<EmptyState icon={PhiIcons.document} title="No documents" description="Upload your first file to get started."/>With Action Button
Loading interactive example…
View source
<script lang="ts"> import { EmptyState } from "phoundry-ui"; import { Button } from "phoundry-ui"; import { PhiIcons } from "phoundry-ui";</script>
<EmptyState icon={PhiIcons.folder} title="No projects yet" description="Create a project to organize your work."> {#snippet action()} <Button variant="primary" icon={PhiIcons.add}>New Project</Button> {/snippet}</EmptyState>Sizes
Loading interactive example…
View source
<script lang="ts"> import { EmptyState } from "phoundry-ui";</script>
<div class="space-y-4 divide-y divide-border-muted"> <EmptyState size="sm" title="Nothing here" description="Small variant." /> <EmptyState size="md" title="Nothing here" description="Medium variant." /> <EmptyState size="lg" title="Nothing here" description="Large variant." /></div>API
From phoundry-ui@0.4.21
| Name | Type | Default | Description |
|---|---|---|---|
icon | string | — | Iconify icon string shown above the title. |
titlerequired | string | — | Main heading text. |
description | string | — | Supporting text below the title. |
action | Snippet<[]> | — | Action area - typically a Button. |
size | "sm" | "md" | "lg" | 'md' | Controls spacing, icon size, and typography scale. |
class | ClassValue | — | Additional CSS classes. |
style | string | — | Inline styles on the stable component root. |
Usage tips
- Use the
actionsnippet to provide a clear call-to-action (e.g. “Create”, “Upload”, “Import”). - Use
size="sm"for inline empty states (e.g. inside a card or panel) andsize="lg"for full-page views. - Always provide a
descriptionto guide the user on what to do next. iconis optional - omit it for text-only empty states in tight layouts.
Styling
.ph-empty-state is the stable root hook. Consumer class values are additive, and style applies to that root. Styling uses vanilla CSS with semantic state attributes. The root emits data-size. Its existing layout sizes, larger illustration-like icon dimensions, action snippet, and text hierarchy are preserved; size controls this display layout rather than a control height. Internal part selectors and --_ph-* properties remain implementation details.