Popover

An interactive floating panel anchored to its trigger — for content too rich for a tooltip.

Import#

import { Popover } from "astralis-ui";
// Popover.Trigger, .Content, .Title, .Description, .Close

Usage#

The trigger toggles on click; the panel takes focus while open and returns it on close. It dismisses on Escape or an outside click (both opt-out). Rule of thumb: hover + read-only → Tooltip; click + interactive → Popover; blocking decision → Modal.

Placement#

side and align compose into twelve anchor positions, with sideOffset / alignOffset for fine-tuning; collisions flip it automatically.

Props#

PropTypeDefaultDescription
side"top" | "right" | "bottom" | "left""bottom"Preferred placement; flips on collision.
align"start" | "center" | "end""center"Alignment along the side.
sideOffset / alignOffsetnumber8 / 0Pixel gaps on each axis.
avoidCollisionsbooleantrueFlip/shift to stay in the viewport.
closeOnEsc / closeOnOutsidePointerbooleantrueDismissal behavior.
open / defaultOpen / onOpenChange— / false / —Controlled API.

Popover.Content takes withArrow; Popover.Trigger and Popover.Close wrap a single element, like Modal's.

Keyboard#

KeyAction
Enter / Space on triggerToggle open
EscClose (topmost overlay first)
TabMoves through the panel and out — focus is not trapped

Accessibility#

  • The panel is role="dialog"; the trigger gets aria-haspopup, aria-expanded and aria-controls automatically.
  • Focus moves into the panel on open and back to the trigger on close.
  • Title/Description wire the dialog's accessible name and description.