shadcn.io is not affiliated with official shadcn/ui
Button examples · Destructive
Button with Text (Destructive) for React
The destructive color, for delete, remove, or anything hard to undo, when the color should warn before the click.
Destructive tints the button with the destructive color. The label still has to say what happens. The color is not a substitute for the words.
Use it for Delete or Remove. If it wipes an account or a lot of rows, confirm first in an Alert Dialog. In React, the variant only changes the look. You still handle the click.
Preview
Installation
FAQ
What color is a destructive Button?
variant="destructive" uses the danger color as a light fill, with danger-colored text. Hover deepens the tint. It reads as a warning sitting next to a primary button.
When should I use the destructive variant?
For an action that removes something or can't be undone: Delete, Remove, Revoke. A normal Save stays on the default variant. One destructive button in a group is usually enough.
Should a delete ask before it runs?
When it can't be undone, open an Alert Dialog from the click and put this variant on the confirm. The button in the demo only shows the color.
How do I change the label?
Replace Button with the action, and name the thing being removed when you know it. Delete selected is clearer than a bare Delete once a count is involved.
Related
- Button with Left Icon (Destructive)An icon on a delete
- Simple Delete Confirmation Alert DialogA simple delete confirmation with a
- Button with Text (Outline)A border, no fill
- Button with Text (Standard)The one filled action
- Loading Button (Destructive)A delete, while it runs
- Badge with Text (Destructive)A destructive badge for an error, a