Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Split Actions Layout Alert Dialog for Svelte

A review dialog with Save as Draft on one side and Cancel plus Publish Now grouped on the other.

UI library: Ark UI

Draft stands alone. Cancel and Publish Now sit together. None of the three buttons saves or publishes.

Split the footer when one path is optional and the other two are the decision. Long labels can stack. A Button row on the page can make the same split. In Svelte, Ark UI does not publish the changes.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Alert Dialog anatomy: content, title, description, cancel, action

Usage

<AlertDialog><AlertDialogTrigger>{#snippet asChild(props)}<Button {...props()} variant="outline">Confirm Action</Button>{/snippet}</AlertDialogTrigger><AlertDialogContent><AlertDialogHeader><AlertDialogTitle>Review Changes</AlertDialogTitle><AlertDialogDescription>Please review your changes before publishing. You can save as draft or publish immediately.</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter class="sm:justify-between"><AlertDialogClose>{#snippet asChild(props)}<Button {...props()} variant="outline">Save as Draft</Button>{/snippet}</AlertDialogClose><div class="flex flex-col-reverse gap-2 sm:flex-row"><AlertDialogCancel>Cancel</AlertDialogCancel><AlertDialogClose>{#snippet asChild(props)}<AlertDialogAction {...props()}>Publish Now</AlertDialogAction>{/snippet}</AlertDialogClose></div></AlertDialogFooter></AlertDialogContent></AlertDialog>

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.

In what order do keyboard users reach the buttons?

In DOM order: Save as Draft, Cancel, Publish Now. The visual order matches, so tabbing never jumps around.

Do all the buttons close the dialog?

Yes; run each action's work in its click handler.

API Reference

Alert Dialog

Sets props. The rest is on the Alert Dialog page.

Button

Sets props and variant="outline". The rest is on the Button page.