Knit UI
GitHub

Playground

Loading playground…

false
false
false
false
true
true
false
false
Playground
<Popover
  position="bottom-start"
  offset="$xs"
  withArrow={false}
  withOverlay={false}
  trapFocus={false}
  keepMounted={false}
  closeOnClickOutside
  closeOnEscape
  disabled={false}
  withRoles={false}
  shadow="md"
/>

Examples

Controlled

Controlled open state — parent owns when the dropdown is visible.

Loading example…

ControlledSourceStorybook

With Arrow

Arrow pointing at the target, shown at several placements.

Loading example…

With ArrowSourceStorybook

Disabled

Disabled — the dropdown cannot open regardless of user interaction.

Loading example…

DisabledSourceStorybook

With Overlay

Full-cover overlay scrim rendered behind the open dropdown.

Loading example…

With OverlaySourceStorybook

With Roles

ARIA dialog roles wired between target and dropdown for assistive technology.

Loading example…

With RolesSourceStorybook

Target Width

Dropdown width matches the trigger element width.

Loading example…

Target WidthSourceStorybook

Shadows

The shadow prop lifts the dropdown off the page using the shared elevation ladder (xsxl). Each popover below is always open and rendered inline (withinPortal={false}) inside its own relative wrapper so the dropdowns sit side by side without overlapping.

Loading example…

ShadowsSourceStorybook

Styles

Per-slot styles targets individual parts — here the dropdown frame and the arrow.

Loading example…

StylesSourceStorybook

Transitions

Configurable enter/exit animation via transitionProps. Pick a preset, then toggle the popover to watch it animate in and out (all driven by the shared Transition engine, so the same presets work on web and native).

Loading example…

TransitionsSourceStorybook

Compound API

Compound API — Target + Dropdown composed inside a single Popover root.

Loading example…

Compound APISourceStorybook

Props

PropTypeDefaultDescription
animationMotionPresetName | undefinedMotion preset for the dropdown — the unified `animation` vocabulary shared with Modal/Dialog/Drawer (e.g. `"fade"`, `"pop"`, `"scale"`). Sugar over `transitionProps.transition`, which wins if both are set.
arrowOffsetPopoverAxisOffset | undefined
$xxs · $xs · $sm · $md · $lg · $xl · $xxl · 4 · 5 · 8
'$xxs'Arrow distance from the start/end edge when `arrowPosition="side"`.
arrowPositionArrowPosition | undefined'side'Arrow alignment: centered, or pinned toward an aligned placement.
arrowRadiusnumber | undefined0Corner radius of the arrow's outward corner in px.
arrowSizenumber | undefined7Arrow edge length in px.
childrenReactNodeTarget + dropdown.
closeOnClickOutsideboolean | undefinedtrueClose the dropdown when a press lands outside it (web).
closeOnEscapeboolean | undefinedtrueClose the dropdown when the `Escape` key is pressed (web).
defaultOpenedboolean | undefinedfalseUncontrolled initial opened state.
disabled systemboolean | undefinedfalsePrevent the dropdown from opening.
keepMountedboolean | undefinedfalseKeep the dropdown mounted while closed (uses display:none).
offsetPopoverOffset | undefined
$xxs · $xs · $sm · $md · $lg · $xl · $xxl · 4 · 8 · 12
'$xs'Gap between the target and dropdown as a space token or px number.
onChange((opened: boolean) => void) | undefinedCalled when the opened state changes (open + close).
onClose(() => void) | undefinedCalled when the dropdown closes.
onDismiss(() => void) | undefinedCalled when the dropdown is dismissed by an outside-press or `Escape` — distinct from `onClose`, which fires on every close (including programmatic / controlled ones).
onOpen(() => void) | undefinedCalled when the dropdown opens.
onPositionChange((position: PopoverPosition) => void) | undefinedCalled with the RESOLVED placement whenever it changes (e.g. on flip/shift).
openedboolean | undefinedControlled opened state.
overlayPropsPartial<OverlayProps> | undefined
positionPlacement | undefined
top · top-start · top-end · bottom · bottom-start · bottom-end · left · left-start · left-end · right · right-start · right-end
'bottom-start'Placement of the dropdown relative to the target.
radius systemRadiusTokens | undefinedDropdown border radius.
returnFocusboolean | undefinedfalseReturn focus to the target when the dropdown closes (web).
shadow system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined
xs · sm · md · lg · xl
'md'Dropdown shadow scale.
strategyStrategy | undefined'fixed'Positioning strategy.
styles systemSlotStyles<PopoverStyles> | undefinedPer-slot style sugar — props spread onto the matching styled part.
transitionPropsOverlayTransitionConfig | undefined{ transition: 'fade', duration: 150, timingFunction: 'ease-in-out' }Enter/exit animation: { transition, duration, exitDuration, timingFunction }. Defaults to a 150ms fade.
trapFocusboolean | undefinedfalseTrap keyboard focus within the dropdown while open.
widthPopoverWidth | undefined
max-content · target · 200 · 300
'max-content'Dropdown width; 'target' matches the trigger width.
withArrowboolean | undefinedfalseShow an arrow pointing at the target.
withinPortalboolean | undefinedtrueRender the dropdown in a portal.
withOverlayboolean | undefinedfalseRender a full-cover overlay scrim behind the open dropdown.
withRolesboolean | undefinedfalseWire ARIA dialog roles between target and dropdown.
zIndexnumber | undefined300Dropdown `z-index`.

Style slots

Every part of Popover can be styled through the styles prop. Explicit props on the component always win over slot styles.

SlotUsage
arrowstyles={{ arrow: { … } }}
dropdownstyles={{ dropdown: { … } }}
overlaystyles={{ overlay: { … } }}