shadcn.io is not affiliated with official shadcn/ui
Popover examples · Standard
Popover with Footer for React
A popover with a title, a line of text, and Cancel and Confirm buttons at the bottom.
A title, a line of text, and Cancel and Confirm at the end of a footer row. Use it for a quick confirmation tied to one control; a decision that can't be undone belongs in an Alert Dialog. In React, Base UI handles opening, dismissing and focus.
Preview
Installation
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.
Related
- Popover with FormA Settings popover with a text input and
- Popover with ActionsA popover with Edit, Share and Delete
- Simple Confirmation Dialog Alert DialogA simple confirmation dialog with Cancel
- Standard DialogA share dialog with a read-only link, a
- Feedback PopoverA Feedback button that opens a popover
- Popover with DividerA popover whose two sections are split by