Skip to content

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
basic.svelte
<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
with-action-button.svelte
<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
sizes.svelte
<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

NameTypeDefaultDescription
iconstring—Iconify icon string shown above the title.
titlerequiredstring—Main heading text.
descriptionstring—Supporting text below the title.
actionSnippet<[]>—Action area - typically a Button.
size"sm" | "md" | "lg"'md'Controls spacing, icon size, and typography scale.
classClassValue—Additional CSS classes.
stylestring—Inline styles on the stable component root.

Usage tips

  • Use the action snippet 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) and size="lg" for full-page views.
  • Always provide a description to guide the user on what to do next.
  • icon is 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.

Documentation is licensed under CC BY 4.0. Phoundry names and marks remain reserved.