Overlays
Popover
A non-modal panel anchored to a trigger, in the browser top layer. Escape and clicks outside close it natively; it flips and shifts to stay on screen.
import { Popover } from '@reactloom/ui';Examples
Filters panel
import { Checkbox, HStack, Input, Popover, Stack } from '@reactloom/ui';
import { SlidersHorizontal } from 'lucide-react';
export default function Example() {
return (
<Popover.Root placement="bottom-start">
<Popover.Trigger startIcon={<SlidersHorizontal />}>Filters</Popover.Trigger>
<Popover.Content>
<Popover.Title>Filter invoices</Popover.Title>
<Stack gap="3">
<Input label="Customer" size="sm" placeholder="Acme" />
<Checkbox label="Overdue only" size="sm" />
<HStack justify="end" gap="2">
<Popover.Close size="sm">Cancel</Popover.Close>
<Popover.Close size="sm" variant="primary">Apply</Popover.Close>
</HStack>
</Stack>
</Popover.Content>
</Popover.Root>
);
}Contextual help
asChild turns any button into the trigger.
Usage resets monthly
import { Popover, Text } from '@reactloom/ui';
import { Info } from 'lucide-react';
export default function Example() {
return (
<Text as="div">
Usage resets monthly{' '}
<Popover.Root placement="top">
<Popover.Trigger asChild>
<button type="button" aria-label="About usage limits" style={{ all: 'unset', cursor: 'pointer', verticalAlign: 'middle' }}>
<Info size={16} aria-hidden />
</button>
</Popover.Trigger>
<Popover.Content size="sm" aria-label="About usage limits">
<Text size="sm">Limits reset on the 1st at 00:00 UTC. Unused quota does not roll over.</Text>
</Popover.Content>
</Popover.Root>
</Text>
);
}API reference
Popover.Root
| Prop | Type | Default |
|---|---|---|
open / defaultOpen | boolean | — |
onOpenChangeEvery open/close path goes through it. | (open: boolean) => void | — |
placementPreferred side; flips when needed. | 'top' | 'bottom' | 'left' | 'right' + '-start' | '-end' | 'bottom-start' |
offsetGap in px. | number | 8 |
Popover.Content
| Prop | Type | Default |
|---|---|---|
size | 'sm' | 'md' | 'lg' | 'auto' | 'md' |
initialFocusRefDefaults to the panel. | RefObject<HTMLElement> | — |
keepMounted | boolean | false |
Parts
| Prop | Type | Default |
|---|---|---|
Trigger · CloseButtons; asChild for your own element. | ButtonProps | — |
TitleNames the popover. | | — |
Customization
Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.
State attributes
Target these in your CSS to style states without depending on class names.
| Attribute | Values |
|---|---|
[data-size] | sm · md · lg · auto |
Theme tokens it reads
--pl-color-bg-surface-raised --pl-color-border-default --pl-color-fg-default --pl-font-size-md --pl-radius-lg --pl-shadow-md
Accessibility
- role="dialog" (non-modal) named by Popover.Title or aria-label; the trigger exposes aria-expanded and aria-controls.
- Focus moves into the panel on open and returns to the trigger when it closes.
- The trigger is registered as the native invoker, so it toggles without close-then-reopen flicker.
| Key | Action |
|---|---|
| Enter / Space | Toggle from the trigger |
| Escape | Close and return focus |
| Tab | Move through the panel |
Usage guidelines
Do
- Use for supplementary controls (filters, quick settings).
Don’t
- Don’t put critical flows in a popover — use Dialog.
- Don’t open popovers on hover.