Alert dialog
RequiredSmall Modal composition with alertdialog semantics.
Overlays
A constrained alert dialog for confirming one consequential or irreversible action.
ConfirmDialogConfirmDialogPropsConfigure the production component, inspect it at responsive widths, copy synchronized JSX, and share the exact state from one workspace.
This JSX stays synchronized with the controls and uses only public package APIs.
'use client';
import { useState } from 'react';
import { Button, ConfirmDialog } from '@ai-created/ui';
export function Example() {
const [open, setOpen] = useState(false);
return (
<>
<Button onClick={() => setOpen(true)}>Open confirmation</Button>
<ConfirmDialog
open={open}
onConfirm={() => setOpen(false)}
onCancel={() => setOpen(false)}
title={"Delete project?"} destructive
description="This action cannot be undone."
/>
</>
);
}
import { ConfirmDialog } from '@ai-created/ui';Client boundary
'use client' to the file that owns this interactive state.Replace the version placeholder with the release tag your product has reviewed.
npm install --install-links "git+https://github.com/TheMarco/ai-created-ui.git#vX.Y.Z"@import '@ai-created/ui/styles/tokens.css';
@tailwind base;
@tailwind components;
@tailwind utilities;module.exports = {
presets: [require('@ai-created/ui/tailwind-preset')],
content: [
'./src/**/*.{js,ts,jsx,tsx,mdx}',
'./node_modules/@ai-created/ui/src/**/*.{js,ts,jsx,tsx}',
],
};Named regions define what belongs to the component, what remains optional, and where semantic responsibility lives.
Small Modal composition with alertdialog semantics.
Names the exact action under confirmation.
Optional consequence and scope explanation.
Safe dismissal path.
buttonExecutes the consequential operation.
buttonThe Figma-equivalent asset model, auto-layout, resizing, properties, slots, content bounds, localization, and governance contract.
Asset kind
component
Design library name
Components/Overlays/Confirm dialog
Maturity
stable
Last reviewed
2026-08-29
Canvas applicability
Publish standard, destructive, and loading variants with localized copy properties.
| Property | Type | Default | Code mapping | Options or notes |
|---|---|---|---|---|
| OpenRequired | boolean | false | open | No additional constraint |
| Destructive | boolean | false | destructive | No additional constraint |
| Loading | boolean | false | loading | No additional constraint |
| TitleRequired | text | Confirm action? | title | No additional constraint |
| Description | slot | None | description | No additional constraint |
| Confirm label | text | Confirm | confirmLabel | No additional constraint |
| Cancel label | text | Cancel | cancelLabel | No additional constraint |
| Loading label | text | Working... | loadingLabel | No additional constraint |
Alert dialog overlay, panel, header, body, and footer.
ModalOverlay and subcomponentsSecondary dismissal action.
ButtonConsequential action and loading state.
ButtonOverflow: Wrap and revise if longer.
The exact decision must be obvious.
Overflow: Move detailed policy outside the dialog.
Users need enough context to decide without overload.
Overflow: Stack actions if localization requires it.
Specific labels reduce confirmation errors.
Translatable: Title, Description, Confirm, cancel, and loading labels
Small modal width with viewport inset.
Parent-selected narrow breakpoint
Accountable owner
Design systems safety pattern owner
Canonical source: src/components/ConfirmDialog.tsx
These measurements and semantic tokens define the supported visual contract. Local overrides should preserve the same hierarchy and interaction cues.
Panel width
max 384px
Footer action gap
12px
Header padding
20px horizontal mobile / 24px md; 12px vertical
Body/footer padding
20px horizontal mobile / 24px md; 16px vertical
Close target
44 × 44px
Close glyph
24 × 24px
Close glyph inset
16px from top and logical end
Inherited from the shared overlay header while the dialog is dismissible.
--color-overlayModal backdrop.
--color-surface / --color-borderPanel and dividers.
--color-action-primaryStandard confirmation.
--color-action-destructiveDestructive confirmation.
--color-on-actionFilled action foreground.
--color-text / --color-text2Title and description.
A component is not complete until its passive, interactive, disabled, and exceptional states remain understandable in both themes.
Semantics, accessible naming, keyboard behavior, focus and announcements are implementation requirements, not optional documentation.
Use the public package API and preserve the controlled-state, native-attribute, and ref contracts described below.
import { ConfirmDialog } from '@ai-created/ui';Client Component required
<ConfirmDialog open={open} title="Delete project?" description="This cannot be undone." onConfirm={remove} onCancel={cancel} destructive />These props and helpers are compatibility contracts. Changes require migration guidance and release notes.
| Prop | Type | Default | Contract |
|---|---|---|---|
| open | boolean | required | Whether the dialog is shown. |
| onConfirm | () => void | required | Confirm callback. |
| onCancel | () => void | required | Cancel callback. |
| title | string | required | Dialog heading. |
| description | ReactNode | undefined | Supporting explanation. |
| confirmLabel | string | Confirm | Confirm button label. |
| cancelLabel | string | Cancel | Cancel button label. |
| destructive | boolean | false | Uses destructive styling. |
| loading | boolean | false | Disables dismissal while working. |
| loadingLabel | string | Working… | Busy button label. |
These rules keep the component recognizable across products without preventing deliberate composition.
The component should be verified as rendered UI, an interaction model, an accessibility surface, and a theme-aware visual artifact.