Hyunsui
Docs
Popover
Floating, transient content that stays anchored to a trigger, mirroring Radix Popover’s API while exposing data attributes for animation control.
Anatomy
Import the parts you need and compose them inside Popover.Root.
API Reference
Root
Manages the open state (controlled or uncontrolled) and wires up ids for aria-labelledby/aria-controls.
PropTypeDefault
open
boolean-
defaultOpen
booleanfalse
onOpenChange
(open: boolean) => void-
Anchor
Optional reference element for Floating UI. Use it when the trigger should not be the positioning anchor.
PropTypeDefault
children / element props
HTMLAttributes<HTMLElement>-
Trigger
Button that toggles the popover. Receives aria-haspopup, aria-expanded, and data attributes automatically.
PropTypeDefault
type
"button" | "submit" | "reset"button
disabled
boolean-
onClick
React.MouseEventHandler<HTMLButtonElement>-
Data AttributeValue
data-state
"open" | "closed"
data-disabled
""
Portal
Portals the floating content to document.body (or a custom container) so that z-index and overflow never get in the way.
PropTypeDefault
container
HTMLElement | nulldocument.body
forceMount
booleanfalse
Content
The floating surface. It exposes data-state for enter/exit animations, wires up role="dialog", exposes all of Radix’s outside-interaction callbacks, and accepts the same positioning knobs (side, align, offsets, collision padding, sticky, etc.).
PropTypeDefault
onOpenAutoFocus
function-
onCloseAutoFocus
function-
onEscapeKeyDown
function-
onPointerDownOutside
function-
onFocusOutside
function-
onInteractOutside
function-
forceMount
booleanfalse
side
"top" | "right" | "bottom" | "left""bottom"
align
"start" | "center" | "end""center"
sideOffset
number8
alignOffset
number0
collisionPadding
number | Partial<{ top: number; right: number; bottom: number; left: number }>8
collisionBoundary
Element | Element[] | null-
avoidCollisions
booleantrue
sticky
"partial" | "always""partial"
hideWhenDetached
booleanfalse
Data AttributeValue
data-state
"open" | "closed"
Close
Convenience button that dispatches setOpen(false) when clicked.
PropTypeDefault
type
"button" | "submit" | "reset"button
onClick
React.MouseEventHandler<HTMLButtonElement>-