shadcn.io is an independent project built on shadcn/ui
Open shows a title that reads Title and the line Content goes here. Cancel and Confirm sit at the end of the panel. Both close it.
Use it for a quick confirm tied to one control. A decision that cannot be undone belongs in an Alert Dialog. In React, Base UI does not perform the confirm.
Installation
Anatomy

Usage
<Popover onOpenChange={setOpen} open={open}>
<PopoverTrigger render={<Button variant="outline" />}>
Open
</PopoverTrigger>
<PopoverContent>
<PopoverHeader>
<PopoverTitle>Title</PopoverTitle>
<PopoverDescription>Content goes here.</PopoverDescription>
</PopoverHeader>
<div className="flex justify-end gap-2">
<Button onClick={handleClose} size="sm" variant="outline">
Cancel
</Button>
<Button onClick={handleClose} size="sm">
Confirm
</Button>
</div>
</PopoverContent>
</Popover>FAQ
How are Cancel and Confirm arranged?
They sit in a div with flex justify-end gap-2. Both are size="sm": Cancel uses variant="outline" and Confirm the default variant. Either one closes the panel.
How do I close this panel from code?
Cancel and Confirm close the panel.
Here the panel is controlled: open and onOpenChange on Popover, and the button's handler sets the state to false. The callback gets the next open state first.
What is the text above the buttons?
PopoverHeader wraps PopoverTitle reading Title and PopoverDescription reading Content goes here. The button row is the next block in PopoverContent.
How does the Open button become the trigger?
The trigger is a Button with variant="outline" and the label Open. Activating it opens the panel. The footer buttons are what set open back to false.
Pass the button to render on PopoverTrigger, and use PopoverContent as the panel.
API Reference
Popover
Sets onOpenChange={setOpen} and open={open}. The rest is on the Popover page.
Button
Sets variant="outline", onClick={handleClose} and size="sm". The rest is on the Button page.





