Skip to content

Popover

Popover Props ​

NameTypeDefaultDescription
placement'above' | 'below' | 'start' | 'end''below'Side of the trigger. Flips when there is no room.
alignment'start' | 'center' | 'end''start'Alignment along the placement axis.
isOpenboolean—Controlled visibility. When unset, the trigger manages visibility.
isEnabledbooleantruePrevents the trigger from opening the surface when false.
widthnumber | stringTrigger widthSurface width. Numbers are pixels. When unset, the surface is at least as wide as the trigger and at most 320px (and never wider than the viewport).
padding0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 103Inner padding, mapped to the --astryx-spacing-* tokens.
labelstring—Accessible name of the dialog. Provide it when role is dialog.
role'dialog' | 'none''dialog'Use dialog for interactive content. Use none when the content already has its own role.
isModalbooleantrueKeeps Tab focus inside the surface while it is open. Applies to dialog only.
hasCloseButtonbooleantrueShows a close button that is visible only when focused.
closeButtonLabelstring'Close'Text and accessible name of the close button.
hasAutoFocusbooleantrueMoves focus into the surface when it opens.
hasLightDismissbooleantrueCloses when the user presses outside the surface and the trigger.
hasEscapeDismissbooleantrueCloses when the user presses Escape.

Events ​

  • openChange(isOpen: boolean): fires when the surface opens or closes, including when the user dismisses it.

Slots ​

  • default: the trigger. Use a button or an element with role="button".
  • content: the surface content.

Theme ​

css
.my-popover {
  --astryx-popover-background: #fff;
  --astryx-popover-foreground: #000;
}
  • --astryx-popover-background: surface background color.
  • --astryx-popover-foreground: surface text color.
  • --astryx-popover-shadow: surface shadow.
  • --astryx-popover-z-index: stacking order of the surface.