Custom Popover
Popover positioned from a trigger with arrow and placement options.
Installation
bun add @xerobi/ui
import { CustomPopover } from "@xerobi/ui/custom-popover"This component is client-side. In Astro, hydrate it with a client directive.
API reference
CustomPopover
Popover anchored to an element, with an arrow that points at it. Pair with `usePopover()`: const popover = usePopover() <button onClick={popover.onOpen} /> <CustomPopover open={popover.open} anchorEl={popover.anchorEl} onClose={popover.onClose} />
| Prop | Type | Description |
|---|---|---|
| open | boolean | |
| onClose | () => void | |
| anchorEl | Element | Element the popover points at (from `usePopover().anchorEl`). |
| children | string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode> | |
| className | string | |
| slotProps | { arrow?: PopoverArrow | undefined; paper?: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> | undefined; } |