DevactionUI.Popover (devaction_ui v0.1.0)

Copy Markdown View Source

A panel anchored to a button, with an arrow: the trigger opens and closes it, Esc and a click outside close it, focus goes into it when it opens and back to the trigger when it closes. It sits under (or over) the trigger inside the same box, so it is for a card, a form or a menu, not for something that has to escape a scrolling container.

placement is :bottom or :top; the hook flips it when there is no room on the screen.

Summary

Functions

popover(assigns)

Attributes

  • id (:string) (required)
  • placement (:atom) - Defaults to :bottom. Must be one of :bottom, or :top.
  • align (:atom) - Defaults to :start. Must be one of :start, or :end.
  • label (:string) (required) - the name of the panel, for assistive technology.
  • class (:any) - Defaults to nil.
  • panel_class (:any) - Defaults to "w-80".
  • Global attributes are accepted.

Slots

  • trigger (required) - what is pressed; the hook puts aria-haspopup, aria-expanded and aria-controls on the button or link inside it (or makes the wrapper a button when there is none).
  • inner_block (required)