LedgerUI.Components.EmptyState (LedgerUI v0.2.0)

Copy Markdown View Source

Empty state: what the area is, why it is empty and the one next step.

<.empty_state icon="inbox" title="No orders yet">
  Orders from the counter and the site show up here.
  <:action><button class="lu-b c-mono v-solid s-sm sh-rounded">New order</button></:action>
</.empty_state>

<.empty_state variant="inline" icon="inbox" title="No comments yet.">
  <a href="#">Write the first</a>
</.empty_state>

Variants:

  • canvas (default) - the canvas lu-empty: icon tile, title, reason, actions;
  • card - centered block for a whole area, icon with pulsing rings (tone default, gradient or positive) and an optional kicker;
  • inline - compact dashed notice for lists and results (color neutral/success/error);
  • table - centered notice for the body of an empty table (a disc tinted by color);
  • plain - the faint one-line notice inside a card.

level (2, 3 or 4) marks the title of a card as a heading (aria-level); without it the title is a plain bold line.

Summary

Functions

Same as empty_state/1 (same attributes and slots), under the name the design vitrine uses.

The one-line empty state inside a panel or a table cell: an icon and a sentence.

Functions

empty_state(assigns)

Attributes

  • variant (:string) - Defaults to "canvas". Must be one of "canvas", "card", "inline", "table", or "plain".
  • title (:string) (required)
  • kicker (:string) - Defaults to nil.
  • icon (:string) - Defaults to nil.
  • tone (:string) - Defaults to "default". Must be one of "default", "gradient", or "positive".
  • color (:string) - Defaults to "neutral". Must be one of "neutral", "success", or "error".
  • level (:integer) - Defaults to nil.Must be one of nil, 2, 3, or 4.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • action - The next step.
  • illustration - Replaces the icon.
  • inner_block - The reason it is empty.

empty_state_card(assigns)

Same as empty_state/1 (same attributes and slots), under the name the design vitrine uses.

Attributes

  • variant (:string) - Defaults to "canvas". Must be one of "canvas", "card", "inline", "table", or "plain".
  • title (:string) (required)
  • kicker (:string) - Defaults to nil.
  • icon (:string) - Defaults to nil.
  • tone (:string) - Defaults to "default". Must be one of "default", "gradient", or "positive".
  • color (:string) - Defaults to "neutral". Must be one of "neutral", "success", or "error".
  • level (:integer) - Defaults to nil.Must be one of nil, 2, 3, or 4.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • action - The next step.
  • illustration - Replaces the icon.
  • inner_block - The reason it is empty.

inline_empty(assigns)

The one-line empty state inside a panel or a table cell: an icon and a sentence.

<.inline_empty icon="inbox" text="No comments yet" />

Attributes

  • text (:string) (required)
  • icon (:string) - Defaults to nil.
  • color (:string) - Defaults to "neutral". Must be one of "neutral", "success", or "error".
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • action - The next step.