PhoenixPaper.Alert (PhoenixPaper v0.1.0)

Copy Markdown View Source

A Material-flavored alert banner (pp_alert/1) — a colored, icon-led message for status feedback, in the spirit of MUI's Alert.

<.pp_alert severity="success">Changes saved.</.pp_alert>

<.pp_alert severity="error" variant="outlined">
  <:title>Something went wrong</:title>
  Could not save your changes. Try again.
  <:action><.pp_button variant="text">Retry</.pp_button></:action>
</.pp_alert>

severity (success/info/warning/error) picks both the color and the leading icon — a distinct axis from every other component's color attr (primary/secondary/tertiary/error), since these are status colors (see priv/static/phoenix_paper.css's --color-pp-success/ -warning/-info), not brand/action colors. error happens to be the one name shared with the rest of the library's color scale, and does mean the same red in both places.

Summary

Functions

Renders an alert. See the module doc.

Functions

pp_alert(assigns)

Renders an alert. See the module doc.

Attributes

  • paperize (:boolean) - Defaults to true.
  • severity (:string) - Defaults to "info". Must be one of "success", "info", "warning", or "error".
  • variant (:string) - Defaults to "standard". Must be one of "standard", "outlined", or "filled".
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • title
  • action
  • inner_block (required)