PUI.Dialog.Primitive (pui v1.0.0)

Copy Markdown

Zero-style dialog parts.

The parts provide dialog semantics and LiveView focus commands without any presentation classes. Compose them when an application owns dialog markup.

hide/2 and show/2 target the backdrop and content elements by ID. They default to the <root-id>-backdrop and <root-id>-content convention; pass :backdrop_id and :content_id when the application uses other IDs.

Summary

Functions

backdrop(assigns)

Attributes

  • id (:string) (required)
  • show (:boolean) - Defaults to false.
  • alert (:boolean) - Defaults to false.
  • root_id (:string) - ID of the dialog root to cancel on backdrop click. Defaults to id without -backdrop. Defaults to nil.
  • Global attributes are accepted.

content(assigns)

Attributes

  • id (:string) (required)
  • show (:boolean) - Defaults to false.
  • alert (:boolean) - Defaults to false.
  • Global attributes are accepted.

Slots

  • inner_block (required)

hide(id, opts \\ [])

root(assigns)

Attributes

  • id (:string) (required)
  • on_cancel (Phoenix.LiveView.JS) - Defaults to %Phoenix.LiveView.JS{ops: []}.
  • show (:boolean) - Defaults to false.
  • backdrop_id (:string) - Defaults to <id>-backdrop. Defaults to nil.
  • content_id (:string) - Defaults to <id>-content. Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

show(id, opts \\ [])