Skip to main content

Module empty_state

Module empty_state 

Expand description

EmptyState — the centered “there’s nothing here yet” placeholder that almost every list-shaped app hand-rolls (Inbox with no mail, a feed with no articles, a contacts book with no contacts, …). Before this widget the pattern was copy-pasted as a Column of a big icon + a heading Text + a dim subtitle + an optional call-to-action Button across the fleet.

EmptyState folds that into one theme-driven widget:

  • an optional large Icon in tertiary ink, or an illustration the app paints into the same slot (a weather scene),
  • a title in the Title role (the “No messages” headline),
  • an optional message: one sentence in secondary ink, rhythm s3 under the title,
  • an optional primary action, s4 under the text.

An error state (EmptyState::error) tints its icon with the danger status colour and bounds its message to one elided line; assistive technology still reads the whole message.

The content is centered on both axes inside whatever space the parent gives the widget, so dropping it as the sole child of a content pane “just works”. The action is surfaced through the toolkit’s drain channel (EmptyState::take_action) rather than a callback, matching the CRDT-native input model used by super::ContextMenu / [super::TriStateControl].

Structs§

EmptyState
A centered empty-state placeholder: hero icon + title + message + action.
EmptyStateContent
What an empty state shows: optional icon or illustration, title, optional message and optional action label.
EmptyStateLayout
Where everything in an empty state goes inside a rect: what EmptyState::paint draws, and what EmptyState::layout hands back without painting.

Type Aliases§

Illustration
Paints an empty state’s illustration into the square it is given.