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
Iconin tertiary ink, or an illustration the app paints into the same slot (a weather scene), - a title in the
Titlerole (the “No messages” headline), - an optional message: one sentence in secondary ink,
rhythms3 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§
- Empty
State - A centered empty-state placeholder: hero icon + title + message + action.
- Empty
State Content - What an empty state shows: optional icon or illustration, title, optional message and optional action label.
- Empty
State Layout - Where everything in an empty state goes inside a rect: what
EmptyState::paintdraws, and whatEmptyState::layouthands back without painting.
Type Aliases§
- Illustration
- Paints an empty state’s illustration into the square it is given.