Installation
$ pnpm dlx shadcn@latest add @synccn/popoverFirst time in this project? Connect synccn with one command.
Usage
import { Popover, PopoverTrigger, PopoverContent } from "@/components/ui/popover";<Popover> <PopoverTrigger><Button>Open</Button></PopoverTrigger> <PopoverContent>…</PopoverContent></Popover>API reference
Generated from the component's TypeScript types, so it always matches the code.
Popover
- open
booleanControlled open state.
- defaultOpen
booleanDefault
falseInitial state when uncontrolled.
- onOpenChange
(open: boolean) => voidCalled when it opens or closes.
- children
React.ReactNodeContent to render.
- className
stringExtra classes for the root element.
PopoverTrigger
Pass a single element; it receives onClick + aria props.
- childrenrequired
React.ReactElement<any>A single element that toggles the popover.
PopoverContent
- side
"top" | "bottom" | "left" | "right"Default
"bottom"Side of the trigger to open on.
- align
"start" | "center" | "end"Default
"center"Alignment along that side.
- className
stringExtra classes for the root element.
- children
React.ReactNodeContent to render.
Also accepts every standard <div> attribute, and forwards its ref.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
npm packages
- clsx for cn()
- tailwind-merge for cn()
Keyboard
- EscClose
Accessibility
- The trigger gets aria-expanded and aria-haspopup automatically.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: dialog
- Closes with Escape
- Closes when you click or tap outside