Popover
Popover surface anchored to its trigger.
- Browsers
- Chrome 114+, Firefox 125+, Safari 17+
- Tier
- 0
- Bundle compressed
- 311 B
- Forced layout budget
- 0 ms
- Axe budget
- 0
- SSR compatible
- Yes
- Published contract
- Test harness
Playground
Changes saved
This panel stays open until you dismiss it.
Changes saved
This panel stays open until you dismiss it.
import { PopoverClose, PopoverContent, PopoverTrigger } from "@gunkin/uiify";
export default function Example() {
return (
<div className="uiify-popover">
<PopoverTrigger target="actions-popover">Actions</PopoverTrigger>
<PopoverContent id="actions-popover" mode="auto" side="bottom" align="center">
<a href="/profile">Profile</a>
<PopoverClose target="actions-popover">Close</PopoverClose>
</PopoverContent>
</div>
);
}API
PopoverClose
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | — |
target | string | — | `id` of the `PopoverContent` this button hides. |
command | string | — | — |
commandfor | string | — | — |
as | ElementType & ("button" | ComponentType<any>) | — | `"button"` (default) or a component that forwards props and ref to a native <button>. |
render | never | — | — |
PopoverContent
| Prop | Type | Default | Description |
|---|---|---|---|
align | AnchorAlign | "center" | — |
children | ReactNode | — | — |
id | string | — | Unique id supplied by the consumer; referenced by trigger and close `target`. |
mode | PopoverSurfaceMode | "auto" | — |
side | AnchorSide | "bottom" | — |
PopoverTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | — |
target | string | — | `id` of the `PopoverContent` this button toggles. |
command | string | — | — |
commandfor | string | — | — |
as | ElementType & ("button" | ComponentType<any>) | — | `"button"` (default) or a component that forwards props and ref to a native <button>. |
render | never | — | — |
Keyboard
| Key | Action |
|---|---|
| Escape | Dismiss |
| Tab | Move into the popover content when open |
Accessibility
Native Popover API: a popovertarget invoker toggles the surface before any JavaScript runs; the browser owns light dismiss, Escape and nesting, and anchors the surface to the invoker that opened it.
Styling hooks
data-sidedata-aligndata-positioning--uiify-trigger-openinside .uiify-popover