Component
Popover
A lightweight floating surface for compact actions and contextual details.
Preview
Installation
Install the package, then import the component and shared stylesheet in your app.
Package install
Install the package when you want components imported from axie-ui.
install
pnpm add axie-uiImport
code
import "axie-ui/styles.css";import { Popover } from "axie-ui";Registry install
Use the direct URL when you want shadcn to copy editable source into your app. This works without the official registry and does not install axie-ui.
registry
pnpm dlx shadcn@latest add https://axie.alexi.life/r/popover.jsonCopied source import
code
import "@/styles/axie.css";import { Popover } from "@/components/axie/popover";Prefer @axie/popover? Add the Axie namespace once from the Installation page, then use that shorthand.
Usage
code
import { Button, Popover } from "axie-ui";export function Example() { return ( <Popover content={<div>Content</div>}> <Button>Open</Button> </Popover> );}Accessibility
- Use popovers for supplemental content, not required form steps.
- Close on Escape and outside interaction.
- Keep the trigger and floating content close in the DOM when possible.
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| align | start | center | end | center | Horizontal alignment against the trigger. |
| content | ReactNode | - | Popover content. |
| open | boolean | - | Controlled open state. |
| onOpenChange | (open: boolean) => void | - | Called when open state changes. |