Skip to content

Popover

import { Popover } from '@yarcl/react';
<Popover>
<Popover.Trigger>
<Button variant="outline">Filters</Button>
</Popover.Trigger>
<Popover.Content>
<Checkbox>Archived</Checkbox>
</Popover.Content>
</Popover>
  • Positioned with Floating UI: it flips and shifts to stay on screen.
  • Closes on Esc and outside click; focus returns to the trigger.
  • modal traps focus inside while open.

For lists, use Menu, Select or Combobox instead.

Spacing props accept typed breakpoint maps. See responsive props for supported props, defaults and examples.

PropTypeDefaultDescription
childrenReactNodePopover.Trigger and Popover.Content.
defaultOpenbooleanfalseInitial open state when uncontrolled.
modalbooleanfalseTraps focus inside the content while open.
onOpenChange(open: boolean) => voidCalled when the popover opens or closes.
openbooleanControlled open state.
placementPlacement'bottom'Preferred side. Flips when there isn't room.
PropTypeDefaultDescription
initialFocusnumber | RefObject<HTMLElement | null>0Element focused when the content opens: an index into its tabbable elements, or a ref.
paddingResponsive<Spacing>configconfig.defaults.paddingInner padding, from the spacing config. Accepts a scalar or breakpoint map.
radiusRadiusconfigconfig.defaults.radiusCorner radius, from the radii config.