AuroraUI. Components. Floating
(Aurora UI v0.1.0)
View Source
Floating family — menu/1, popover/1, and tooltip/1.
These sit in the top layer next to their anchor. Positioning — collision flipping against the viewport edges, working inside scroll containers, staying correct at 200–400% zoom, and honoring RTL writing direction — is done by the JavaScript hook at runtime; the server renders the semantics and a sensible default placement. Each hook also owns light-dismiss (Escape / click-away / blur) so the markup below stays declarative.
Choosing between them
menu/1— a list of application actions (role="menu"/menuitem) with roving focus, typeahead, and arrow-key navigation. Not for navigation links — useAuroraUI.Components.Navigationfor those.popover/1— richer, non-modal interactive content anchored to a trigger. Built on the nativepopoverattribute for a working baseline, then enhanced for positioning.tooltip/1— supplementary text only, shown on hover and focus and referenced byaria-describedby. Never put required instructions or the only copy of an action's label in a tooltip.
DOM contract
| Component | phx-hook | data attributes |
|---|---|---|
menu | AuroraMenu | data-aui-menu, [role=menuitem] children |
popover | AuroraPopover | data-aui-popover, data-aui-anchor, data-aui-placement |
tooltip | AuroraTooltip | data-aui-tooltip, data-aui-anchor, data-aui-placement |
Summary
Functions
An actions menu: a trigger button plus a role="menu" list of menuitems.
A non-modal popover anchored to a trigger, using the native popover
attribute as a progressive baseline (light-dismiss + top layer for free) and
the hook for anchored positioning.
A tooltip showing supplementary text on hover and keyboard focus.
Functions
A non-modal popover anchored to a trigger, using the native popover
attribute as a progressive baseline (light-dismiss + top layer for free) and
the hook for anchored positioning.
Focus behavior works for keyboard, touch, and mouse: opening moves focus into the panel when it holds controls, Escape and outside clicks close it, and focus returns to the trigger. Because it is non-modal the rest of the page stays interactive.
When not to use
For a required decision use AuroraUI.Components.Overlay.alert_dialog/1; for a
short list of actions use menu/1; for a hint use tooltip/1.
Examples
<.popover label="Account">
<:trigger><.avatar /></:trigger>
<p>Signed in as jane@acme.com</p>
<.button variant="ghost" phx-click="sign_out">Sign out</.button>
</.popover>Attributes
id(:string) - Defaults tonil.label(:string) (required) - accessible name for the trigger button.placement(:string) - preferred logical placement; the hook flips it on collision. Defaults to"bottom". Must be one of"top","bottom","start", or"end".variant(:string) - Defaults to"secondary". Must be one of"primary","secondary","ghost", or"subtle".size(:string) - Defaults to"md". Must be one of"sm","md", or"lg".- Global attributes are accepted.
Slots
trigger- custom trigger content; defaults to the label text.inner_block(required) - popover panel content.
A tooltip showing supplementary text on hover and keyboard focus.
The panel has role="tooltip" and is referenced from the trigger via
aria-describedby, so assistive tech announces it as a description. The hook
mirrors aria-describedby onto the focusable child, positions the tooltip,
and hides it on Escape/blur.
When not to use
Never place required instructions, error text, or an interactive control's only accessible name in a tooltip — it is supplementary and can be missed by touch users.
Examples
<.tooltip text="Sync runs every 5 minutes">
<.icon_button label="Sync info"><.info_icon /></.icon_button>
</.tooltip>Attributes
id(:string) - Defaults tonil.text(:string) (required) - supplementary text (not required instructions).placement(:string) - preferred placement; the hook flips it on collision. Defaults to"top". Must be one of"top","bottom","start", or"end".- Global attributes are accepted.
Slots
inner_block(required) - the trigger element (a focusable control).