Tally UI
Primitives

Popover

A floating panel anchored to a trigger element for displaying rich content.

Import

import { Popover } from '@tallyui/primitives';

Usage

<Popover.Root open={open} onOpenChange={setOpen}>
  <Popover.Trigger>
    <Text>Show Info</Text>
  </Popover.Trigger>
  <Popover.Portal>
    <Popover.Overlay />
    <Popover.Content sideOffset={4}>
      <Text>Popover content here</Text>
      <Popover.Close>
        <Text>Dismiss</Text>
      </Popover.Close>
    </Popover.Content>
  </Popover.Portal>
</Popover.Root>

Components

Popover.Root

Manages the open/closed state and trigger positioning. Does not render a DOM element.

PropTypeDefaultDescription
openbooleanControlled open state
defaultOpenbooleanfalseInitial state (uncontrolled)
onOpenChange(open: boolean) => voidCalled when open state changes

Popover.Trigger

A pressable that toggles the popover.

PropTypeDefaultDescription
asChildbooleanfalseMerge props onto child instead of rendering

Plus all React Native PressableProps.

Popover.Portal

Renders children into a portal.

PropTypeDefaultDescription
forceMounttrueAlways mount portal content
hostNamestringTarget portal host name

Popover.Overlay

An optional backdrop. Pressing it closes the popover by default.

PropTypeDefaultDescription
closeOnPressbooleantrueWhether pressing the overlay closes the popover
forceMounttrueAlways render the overlay
asChildbooleanfalseMerge props onto child instead of rendering

Plus all React Native PressableProps.

Popover.Content

The positioned floating panel. Accepts all PositionedContentProps for anchoring.

PropTypeDefaultDescription
side'top' | 'bottom''bottom'Preferred side relative to the trigger
sideOffsetnumber0Distance from the trigger
align'start' | 'center' | 'end''center'Alignment along the trigger
alignOffsetnumber0Offset from the aligned edge
avoidCollisionsbooleantrueShift to stay within the viewport
forceMounttrueAlways render the content
asChildbooleanfalseMerge props onto child instead of rendering

Plus all React Native ViewProps. See the overview for the full PositionedContentProps reference.

Popover.Close

A pressable that closes the popover.

PropTypeDefaultDescription
asChildbooleanfalseMerge props onto child instead of rendering

Plus all React Native PressableProps.

Accessibility

  • Role: dialog on Content
  • ARIA: aria-expanded on Trigger
  • Focus is managed when the popover opens and closes on web
  • Escape key closes the popover on web

On this page