Skip to content

GhostEmptyState ​

GhostEmptyState is a presentational block for regions with nothing to show: an empty table body, a filter with no matches, or an unused panel. It provides title, description, optional visual, and optional actions in a predictable reading order. The consumer owns why the region is empty; there are no built-in mode enums.

Import it from @ghostvue/themes for the default visual treatment. For headless markup with your own styles, see Advanced: headless composition.

Recover from an empty search ​

Filtered deployment list

Filter with no matches shows a themed GhostEmptyState; clearing it restores the list, a status line announces the result count, and focus returns to the filter.

0 of 3 environments match

No matching deployments

No environment matched "canary-eu". Clear the filter to view all three environments.

The deployment filter starts with a query that matches nothing, so the themed GhostEmptyState from @ghostvue/themes (as="section") replaces the list with a decorative visual, a heading, a description that names the query, and a Clear filter action. Clearing the filter, or pressing Reset beside it, brings the list back.

The empty state itself is static copy and is not a live region. The result count above it is: one role="status" line stays mounted and changes in place from "0 of 3 environments match" to "Showing all 3 environments", so assistive technology hears the outcome of each edit. Both clear buttons unmount once the filter is empty, so the example returns focus to the filter input instead of leaving it on the page body.

Invite a first action ​

Themed empty state

Visual, title, description, and actions with default CSS.

Start a project

Projects you create will appear in this list.

An unused panel pairs a visual, title, and description with one primary action. The themed wrapper sets data-themed on the inner root so default CSS applies without an extra element between table structures.

Table body cell ​

The default root is a div, which is valid inside a td. Put the empty state in a cell that spans every column, and use as="section" only when you need a landmark and the parent context allows it. The headless table cell example shows the markup.

Accessibility ​

  • Provide a #title when the empty region needs a programmatic name.
  • Keep meaningful text in #title or #description; visuals are decorative.
  • Do not use role="status" on the root; empty copy is static unless the consumer adds a live region.
  • Pair with table captions or grid counts on the data widget, not inside this primitive.

See the specification for the full contract.

Advanced: headless composition ​

For teams that bring their own design system, the headless GhostEmptyState from @ghostvue/vue renders the same parts with no styles.

Basic use ​

Empty state basics Headless

Title and description for an unused panel.

No reports yet

Create a report to see revenue summaries here.

When as="section" and the #title slot is present, the root links to the heading with aria-labelledby. A default div root never sets aria-labelledby (generic role cannot be named that way). The visual wrapper is aria-hidden so icons do not duplicate the title in the accessibility tree.

Filtered results with actions ​

Filtered empty results Headless

Copy and an action when filters hide every row.

No matching rows

Nothing matches the current filters. Try clearing one or more constraints.

Actions stay in the #actions slot. Use native buttons and links; the empty state does not wrap them in a toolbar role.

Headless table body cell ​

Empty table body Headless

EmptyState inside a colspan cell.

Quarterly revenue
RegionAmount

No rows for this quarter

Import a CSV or connect a data source to populate the table.

Composable ​

Composable empty state Headless

useGhostEmptyState bindings on a custom host.

Custom host

Composable root bindings without the SFC.

useGhostEmptyState returns as, headingTag, titleId, and rootProps for custom hosts that still follow the part contract.

API ​

PropTypeDefaultDescription
asGhostEmptyStateElement"div"Root element. Prefer div inside table cells.
headingLevelGhostEmptyStateHeadingLevel3Heading level wrapping the title slot.
SlotSlot propsDescription
actions—Optional buttons or links; not a tab stop itself.
description—Optional supporting copy in a div wrapper.
title—Optional heading copy. Rendered as h1–h6 from headingLevel.
visual—Optional decorative graphic. Wrapper is aria-hidden.

@ghostvue/themes adds no props, events, or slots to the headless GhostEmptyState API, which it forwards.

Native attributes fall through to the root. The component sets class, data-ghost-empty-state, data-part="root", and aria-labelledby when as="section" and a title is present.

The root exposes element: HTMLElement | null through a template ref.