PopoverDisplays rich content in a portal, triggered by a button.
The Popover component consists of several parts, each with their own props:
Customize how the popover aligns with its trigger.
The Callout component includes appropriate ARIA attributes for accessibility:
The Popover component provides a way to display rich content in a portal when triggered by a button. It supports accessibility features, positioning options, and customizable styling.
Install the component from your command line.
npm install @raystack/apsara
import { Popover, Button, Text } from '@raystack/apsara/v1' <Popover> <Popover.Trigger asChild> <Button>Open Popover</Button> </Popover.Trigger> <Popover.Content> <Text size="2">This is the popover content</Text> </Popover.Content> </Popover>
defaultOpen
: Boolean to control the default open stateopen
: Controlled open stateonOpenChange
: Callback when open state changesmodal
: Boolean to enable modal behavior
ariaLabel
: Accessible label for the popover content (default: "Popover content")side
: Preferred side of the trigger to render ("top" | "right" | "bottom" | "left")sideOffset
: Distance in pixels from the triggeralign
: Alignment relative to trigger ("start" | "center" | "end")alignOffset
: Offset in pixels from alignment edgeavoidCollisions
: Boolean to prevent collision with viewport edgescollisionPadding
: Padding between content and viewport edges
asChild
: Boolean to merge props onto child element
loading...
loading...
- Uses semantic HTML elements for proper structure
- Dismiss button includes
aria-label
for screen readers