Empty state
ProFills a region with nothing to show: no posts yet, no results, coming soon, or couldn't load with a retry. Not an M3 component (@windmorph/react-pro).
import { EmptyState } from '@windmorph/react-pro';Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.
Props
EmptyState 14 props
The icon, drawn at the size's icon size in the colour's content role. Decorative.
What's missing, in a few words: "No posts yet", "No results".
One line about why, or what will appear here.
Up to two
Buttons: at most onefilledortonal, then atextone.plain(no container) or a card variant.smin a list or small card,mdin a section,lgfor a page area.colortype"primary" | "secondary" | "tertiary" | "neutral" | "error" | "success" | "warning"default"secondary"The icon container's colour roles:
errorfor "couldn't load",successfor "all done",warningfor something to look at.The icon container's shape:
circleor a shape outline (shape={cookie9SidedShape}).Makes the title a heading of this level, when the empty state is a section's only content. Left out, the title is a paragraph.
Announces the title and description to screen readers (
role="status"), for an empty state that replaces content after a search or filter. The region goes into the page first and its content shows a moment later, so it's announced as it appears.The root element.
Classes for each part, merged after the defaults; consumer classes always win.
The root, after the variant's own classes;
classNameis added after it.The icon's shaped container (
ShapedIcon's root).The icon inside its container.
The title.
The description line.
The row that holds
actions.
Classes for the root element, merged with the component's own (yours win).
Inline styles for the root element.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
Spec status
Not part of Material Design 3: a Windmorph Pro component, built on M3's colour roles, type scale, shapes and motion. Its variants and configurations each link to a live example.
| Item | Status | Details |
|---|---|---|
| Variant: plain, filled, elevated, outlined | Built | Variant · Variants, No posts |
| Size: sm, md, lg | Built | Configuration · Variants, Search, Retry |
| Colour and an M3 Expressive shape (a shape constant) | Built | Configuration · Search, Retry, Done |
| Nothing here yet | Built | Use case · No posts |
| No results, announced | Built | Use case · Search |
| Couldn’t load, with a retry | Built | Use case · Retry |
| All caught up, at the end of a feed | Built | Use case · Done |
M3 Expressive specs
- Shape
rounded-full- Variants
plain, filled, elevated, outlined
Variants, sizes and colours
variant:plain(the default) sits on whatever surface it's in;filled,elevatedandoutlinedwrap it in the matching Card, to sit among cards.size:smin a list or small card,mdin a section,lgfor a page area. Each uses its own type roles, icon size and spacing.colorcolours the icon container with a container role: secondary (the default), primary, tertiary, neutral, success for "all done", warning, or error for "couldn't load".shapeis a circle or a shape outline (shape={cookie9SidedShape}, any of the 35 constants from@windmorph/react/primitives, or your ownMaterialShapePath).- Give at most one filled or tonal action, and a text action second, so the empty state never competes with the page's main action.
Theming
- Only colour roles: the colour's container and content roles for the icon,
on-surfacefor the title andon-surface-variantfor the description, so it follows every theme, mode and contrast level. - Override the container colour with
className, and any part withclassNames(root, media, icon, title, description, actions). A plain root carriesdata-tokens="wm-empty-state"; it has no values of its own to override beyond the roles above. - It fades in on the default effects spring, under reduced motion too. With
announce, its live region goes into the page a moment before its content, so screen readers read it; one in the server's HTML shows at once.