ShadcnUI.Components.Overlays.Popover (shadcn_ui v1.0.0)

Copy Markdown View Source

Native nonmodal Popover with optional CSS anchor placement.

The browser owns open state, implicit invoker relationships, sequential focus, Escape, light dismiss and focus return. Manual mode does not light-dismiss or close on Escape. Applications own replacement, outcomes and fallback routes. No toggle listener, positioning engine or package JavaScript is installed.

Summary

Functions

Renders an initially hidden native popover and a declarative button invoker.

Functions

popover(assigns)

Renders an initially hidden native popover and a declarative button invoker.

Supply exactly one naming source: title, accessible_label, or labelledby referencing existing caller headings. close is optional but recommended for manual mode. action=:hide only hides a surface opened by another caller invoker; it does not create a server-owned open snapshot. Trusted trigger and close slots must contain noninteractive labels, not nested controls.

Attributes

  • id (:string) (required)
  • mode (:atom) - Defaults to :auto. Must be one of :auto, or :manual.
  • action (:atom) - Defaults to :toggle. Must be one of :toggle, :show, or :hide.
  • placement (:atom) - Defaults to :block_end. Must be one of :block_start, :block_end, :inline_start, or :inline_end.
  • accessible_label (:string) - Defaults to nil.
  • labelledby (:string) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • trigger_class (:any) - Defaults to nil.
  • close_class (:any) - Defaults to nil.
  • trigger_rest (:map) - Defaults to %{}.
  • surface_rest (:map) - Defaults to %{}.
  • close_rest (:map) - Defaults to %{}.
  • Global attributes are accepted.

Slots

  • trigger (required)
  • title
  • description
  • inner_block (required)
  • close
  • fallback