Skip to content

Popover

The Popover component provides a way to display content in a floating panel that is anchored to a trigger element.

Import

import { Popover } from "@cfa/react-core";

Live Editor

Examples

Default Popover

A basic example of the Popover component with a trigger and a panel.

Custom Trigger

Using a custom trigger element wrapped in a Pressable component.

Placement

You can control the position of the popover relative to its trigger using the placement prop. The default placement is bottom.

Composition

The Popover component offers two different ways to use it. The simplified Popover.Panel approach (recommended) or the more granular approach using Popover.Wrapper and Popover.Dialog.

For most use cases, we recommend using Popover.Panel. It combines the Wrapper and Dialog components into a single, convenient component.

Alternative: Wrapper & Dialog

For advanced use cases where you need more control over the structure, you can use the Wrapper and Dialog components directly. However, this is generally not necessary and adds complexity.

Events

The Popover component provides an onOpenChange event that allows you to track and control when the popover opens or closes.

Props

Visit the Documentation Site for the full list of props.

NameTypeDefaultDescription
defaultOpenboolean-Whether the overlay is open by default (uncontrolled).
isOpenboolean-Whether the overlay is open by default (controlled).
onOpenChange(isOpen: boolean) => void-Handler that is called when the overlay's open state changes.