Skip to main content
  1. Docs
  2. Components
  3. Overlays

Popover

Content on demand, anchored to its trigger: filters, a quick edit, a detail. Not modal.

Import
@qeetrix/react
Status
StableSince 0.0.2
Renders
<div role="dialog">Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

Import

popover.tsx
// From the package: a build keeps only what it uses.
import { Popover, PopoverTrigger, PopoverContent, PopoverClose } from "@qeetrix/react";

// Or from its own path.
import { Popover, PopoverTrigger, PopoverContent, PopoverClose } from "@qeetrix/react/popover";

02

Props

And every native attribute of the element it renders.

PropTypeDefaultWhat it does
Popover: open · defaultOpen · onOpenChangebooleanfalseIts open state.
PopoverContent: title · descriptionReactNode—Its heading names it; the line describes it.
PopoverContent: aria-label · aria-labelledbystring—Its name without a visible title; in development it warns without one.
PopoverContent: side · align…"bottom" · "center"Where it opens; it flips when there's no room.
PopoverContent: sideOffsetnumber6Distance from the trigger, in px.
PopoverContent: anchorElement | refthe triggerPosition against another element: the field a button sits in.
PopoverTrigger · PopoverClose: renderReactElement—Your own control.

03

Parts

Each part carries a data-slot, for tests and placement.

data-slotElementWhat it is
popover-positioner<div>Places it.
popover-popup<div role="dialog">The panel.
popover-header<div>popover-title and popover-description.

04

Against the whole field

anchor: a button at a field's end opens its popover under the field.

schedule.tsx
const field = useRef<HTMLDivElement>(null);

<div ref={field}>
  <Input endAdornment={<PopoverTrigger render={<IconButton icon={ClockIcon} aria-label="Pick a time" />} />} />
</div>
<PopoverContent anchor={field} aria-label="Pick a time">…</PopoverContent>
Next — PopoverAccessibility