DocsComponentsTemplatesThemesGitHub

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.json

Guidelines

  • 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

PropTypeRequired
openbooleanYes
titleReact.ReactNodeYes
descriptionReact.ReactNodeNo
tone'default' | 'danger'No
iconstringNo
confirmLabelstringNo
cancelLabelstringNo
loadingbooleanNo
onConfirm() => voidNo
onCancel() => voidNo
containedbooleanNo
classNamestringNo

Edit this example on GitHub