Popover
Displays rich content in a portal, triggered by a button.
Name@spark-ui/popover
Version1.1.2
LicenseMIT
Attribute | Type | Description | Default |
open | boolean | - | null |
defaultOpen | boolean | - | null |
onOpenChange | (open: boolean) => void | - | null |
modal | boolean | - | null |
Popover.Trigger#
The button that toggles the popover. By default, the Popover.Content will position itself against the trigger.
Attribute | Type | Description | Default |
asChild | boolean | - | {"value":false} |
Popover.Anchor#
An optional element to position the Popover.Content against. If this part is not used, the content will position alongside the Popover.Trigger.
Attribute | Type | Description | Default |
asChild | boolean | - | {"value":false} |
virtualRef | RefObject<Measurable> | - | null |
Popover.Portal#
When used, portals the content part into the body.
Attribute | Type | Description | Default |
forceMount | true | Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. | null |
container | HTMLElement | - | null |
Popover.Content#
The component that pops out when the popover is open.
Attribute | Type | Description | Default |
forceMount | true | Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries. | null |
asChild | boolean | - | {"value":false} |
side | "top" | "right" | "bottom" | "left" | - | bottom |
sideOffset | number | - | 8 |
align | "center" | "end" | "start" | - | center |
alignOffset | number | - | null |
arrowPadding | number | - | 16 |
collisionBoundary | Element | Element[] | - | null |
collisionPadding | number | Partial<Record<"top" | "right" | "bottom" | "left", number>> | - | {"value":0} |
sticky | "partial" | "always" | - | partial |
hideWhenDetached | boolean | - | {"value":false} |
avoidCollisions | boolean | - |
|
onEscapeKeyDown | (event: KeyboardEvent) => void | Event handler called when the escape key is down. Can be prevented. | null |
onPointerDownOutside | (event: PointerDownOutsideEvent) => void | Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`. Can be prevented. | null |
onFocusOutside | (event: FocusOutsideEvent) => void | Event handler called when the focus moves outside of the `DismissableLayer`. Can be prevented. | null |
onInteractOutside | (event: PointerDownOutsideEvent | FocusOutsideEvent) => void | Event handler called when an interaction happens outside the `DismissableLayer`. Specifically, when a `pointerdown` event happens outside or focus moves outside of it. Can be prevented. | null |
onOpenAutoFocus | (event: Event) => void | Event handler called when auto-focusing on open. Can be prevented. | null |
onCloseAutoFocus | (event: Event) => void | Event handler called when auto-focusing on close. Can be prevented. | null |
matchTriggerWidth | boolean | - | {"value":false} |
enforceBoundaries | boolean | - | null |
hasCloseButton | boolean | When there is a close button, padding to the right side must be adjusted to avoid content overlapping with it. | null |
Popover.Header#
Header for the popover content. Also serve as an accessible name for the Popover. Must be rendered inside Popover.Content.
Attribute | Type | Description | Default |
className | string | - | null |
Popover.CloseButton#
The button that closes an open popover.
Attribute | Type | Description | Default |
asChild | boolean | - | null |
Popover.Arrow#
An optional arrow element to render alongside the popover. This can be used to help visually link the anchor with the Popover.Content. Must be rendered inside Popover.Content.
Attribute | Type | Description | Default |
asChild | boolean | - | {"value":false} |