SlopUI.Components.Alert (SlopUI v0.1.0)

Copy Markdown View Source

Inline alerts.

Summary

Functions

Renders an alert. Uses role="alert" for danger/warning (assertive) and role="status" otherwise (polite), so live announcements match urgency.

Functions

alert(assigns)

Renders an alert. Uses role="alert" for danger/warning (assertive) and role="status" otherwise (polite), so live announcements match urgency.

<.alert color="success" title="Saved">Your changes are live.</.alert>
<.alert color="danger" on_close={JS.hide(to: "#err")} id="err">Something broke.</.alert>

Attributes

  • id (:string) - Defaults to nil.
  • color (:string) - Defaults to "neutral". Must be one of "neutral", "accent", "success", "warning", "danger", or "info".
  • title (:string) - Defaults to nil.
  • icon (:boolean) - Defaults to true.
  • on_close (Phoenix.LiveView.JS) - when given, renders a close button. Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)