ConfirmDialog
Alert dialog that confirms an action; `tone="danger"` for destructive ones.
Code
import * as React from 'react';
import { ConfirmDialog } from '@fruit-labs/design';
export default function Demo() {
return (
<div
style={{
position: 'relative',
height: 350,
borderRadius: 20,
overflow: 'hidden',
background: 'var(--bg)',
}}
>
<ConfirmDialog
open
contained
tone="danger"
title="Delete “Billing migration”?"
description="The project and its 14 files will be removed for everyone. This can’t be undone."
confirmLabel="Delete"
{...{
onCancel() {},
}}
{...{
onConfirm() {},
}}
/>
</div>
);
}Install
From npm:
npm install @fruit-labs/design
import { ConfirmDialog } from '@fruit-labs/design';Or copy the TypeScript source into your project:
npx shadcn@latest add https://design.fruitlabs.online/r/confirm-dialog.jsonGuidelines
- Name the object and the consequence: "Delete ‘Billing migration’? 14 files will be removed."
- Cancel first, confirm second; the confirm label repeats the verb.
Props
| Prop | Type | Required |
|---|---|---|
open | boolean | Yes |
title | React.ReactNode | Yes |
description | React.ReactNode | No |
tone | 'default' | 'danger' | No |
icon | string | No |
confirmLabel | string | No |
cancelLabel | string | No |
loading | boolean | No |
onConfirm | () => void | No |
onCancel | () => void | No |
contained | boolean | No |
className | string | No |