EmptyState

July 6, 2026 · View on GitHub

Centered placeholder for empty lists, missing data, or zero-result screens. Stack of optional illustration → title → description → actions.

Contract

<kp-empty-state> renders four optional pieces in a single centered column:

<kp-empty-state size="md">
  ├─ <div class="kp-es__illustration">     (Show Illustration = true)
  │   └─ [kpEmptyStateIcon]               (slot — SVG with stroke="currentColor")
  ├─ <div class="kp-es__text">
  │   ├─ <h3 class="kp-es__title">…</h3>
  │   └─ <p class="kp-es__desc">…</p>     (Show Description = true)
  └─ <div class="kp-es__actions">
      └─ [kpEmptyStateActions]            (slot — usually <button kpButton> instances)

The illustration is a circular gray container; project an icon SVG into the [kpEmptyStateIcon] slot — color it via inline color: on a wrapping span for warning/error variants. Actions are a flex row beneath the text — slot 1-2 buttons.

Sizes

SizeIllustrationIconTitleDescriptionVertical padding
sm4824text/mdtext/sm32
md6432text/lgtext/md48
lg8040text/xltext/md64

API

Inputs

NameTypeDefaultDescription
size'sm' | 'md' | 'lg''md'Compact / page / hero scales
titlestring''Required — main one-liner explaining the empty state
descriptionstring''Secondary copy (only rendered when showDescription=true)
showIllustrationbooleantrueRender the circular icon container
showDescriptionbooleantrueRender the description below the title

Slots

  • [kpEmptyStateIcon] — illustration content. Use a 24×24 SVG with stroke="currentColor" so it inherits the illustration container's color. Wrap in a span with color: style for color overrides (red for errors, etc.).
  • [kpEmptyStateActions] — action buttons. Typically 1-2 <button kpButton> instances (Primary + Secondary ghost). The slot is hidden when empty.

Do / Don't

Do

  • Keep titles short and emotionally honest. "No items yet" beats "Empty list".
  • Pair with one clear call-to-action when there's a sensible next step ("Create item", "Refresh", "Upload"). Skip the action when truly nothing can be done.
  • Use a colored icon for error/warning states (<span style="color:#DC2626"><svg ...></span>).
  • Use size="sm" inside cards / panels; size="md" for pages; size="lg" only for full-screen onboarding.

Don't

  • Don't dump multiple paragraphs into the description. If you need that much copy, link to docs.
  • Don't show two primary actions side-by-side. Pair primary + ghost for two-action layouts.
  • Don't use EmptyState for loading skeletons — that's a different pattern (Skeleton component).
  • Don't make the illustration the focal point of the page. Title + actions carry the meaning; the icon is decoration.

References

Changelog

  • 0.1.0 — Initial release. Three sizes, slot-driven illustration + actions, optional description.