Skip to main content

Module empty_state

Module empty_state 

Expand description

EmptyState — the centered “there’s nothing here yet” placeholder almost every list-shaped app hand-rolled (Inbox with no mail, a feed with no articles): one theme-driven widget for an optional large Icon in tertiary ink (or an illustration the app paints in the same slot), a title in the Title role, an optional one-sentence message in secondary ink s3 under it, and an optional primary action s4 under the text.

An error state (EmptyState::error) tints its icon with the danger status colour, and its message wraps to its full text: what went wrong and what to do about it is never cut off. What went wrong technically (an error code, what a service answered) is not the person’s message: EmptyState::with_details keeps it behind a “Details” disclosure, closed until someone opens it.

The content is centered on both axes inside whatever space the parent gives, 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 of super::ContextMenu.

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.
EmptyStateProps
What a place says while it holds nothing: one sentence, and at most one action that starts filling it.
PaintedAction
An empty-state action as it was painted with EmptyState::paint: the state it belongs to and where both stand, through the paint transform they were drawn with.
PaintedEmptyStates
The empty states a host’s content painted itself with EmptyState::paint, described for it: each becomes a group named by its title with its action as a button where it was drawn, unless the content describes that button already. Activating the button clicks where it is drawn, exactly as a pointer would, so the content’s own hit test runs it.

Functions§

record_painted_actions
Keep every empty-state action painted on this thread from now on, until the matching take_painted_actions hands them over. Recordings nest: what an inner one takes is also kept by the one around it.
take_painted_actions
The empty-state actions painted since the matching record_painted_actions, ending that recording.

Type Aliases§

Illustration