shadcn.io is not affiliated with official shadcn/ui
Alert Dialog examples · Custom Actions
Split Actions Layout Alert Dialog for React
An alert dialog with a secondary action on one side and Cancel and the main action on the other.
Three choices need a layout that shows how they relate. This React alert dialog puts Save as Draft on its own on one side and Cancel and Publish Now together on the other, so the alternative path is clearly separate from the final decision. It's shadcn.io's Alert Dialog on Base UI with a split footer.
Preview
Installation
FAQ
How do I decide which buttons go together?
Cancel and Publish Now are the final decision, stop or go, so they share a group. Save as Draft neither publishes nor cancels; it's an alternative, so it stands apart.
What order should the buttons follow?
The alternative first, then Cancel, then the primary action last. That puts the commit where people expect it and keeps it away from where they click by habit.
How is the footer split?
AlertDialogFooter takes sm:justify-between, with Save as Draft on its own and the other two in a flex gap-2 group. Below sm everything stacks full width.
Can I add more secondary actions on the left?
Avoid it. One alternative is clear; several create a decision of their own. Put extra options in a menu, or reconsider whether they belong in the dialog.
Related
- Vertical Button Stack Alert DialogAn alert dialog with its actions stacked
- Mixed Button Styles Alert DialogAn alert dialog with Cancel on one side
- Confirmation with Custom Button Labels Alert DialogA confirmation dialog whose buttons name
- Single Input Dialog Alert DialogAn alert dialog with one prefilled input
- Standard DialogA share dialog with a read-only link, a
- Simple Confirmation Dialog Alert DialogA simple confirmation dialog with Cancel