ConfirmDialog
Confirmation dialog composition for important or destructive actions.
Preview
A live, theme-aware example rendered with the published component.
Loading preview…
Import
Import the component from its dedicated entry point to keep the dependency and generated bundle explicit.
tsximport { ConfirmDialog } from "@tavojs/ui/confirm-dialog";Normal Tavo.js applications load component styles through the Tavo.js UI plugin. If the application manages component CSS manually, also import @tavojs/ui/css/confirm-dialog.
When to use
Use it when
Choose something else when
Examples
ConfirmDialog example
tsximport { ConfirmDialog } from "@tavojs/ui/confirm-dialog";
export function ConfirmDialogExample1() {
const remove = () => undefined;
const close = () => undefined;
return (
<>
<ConfirmDialog open title="Delete file" onConfirm={remove} onCancel={close} />
</>
);
}Common props and defaults
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Optional class hook applied to the public root element owned by the component. |
open | boolean | — | Configures open for this component. |
title | Child | — | Configures title for this component. |
description | Child | — | Configures description for this component. |
confirmLabel | Child | — | Configures confirmLabel for this component. |
cancelLabel | Child | — | Configures cancelLabel for this component. |
tone | "primary" | "danger" | — | Configures tone for this component. |
onConfirm | () => void | — | Configures onConfirm for this component. |
onCancel | () => void | — | Configures onCancel for this component. |
Complete TypeScript API
Import from @tavojs/ui/confirm-dialog. Published exports: ConfirmDialog, ConfirmDialogProps.
ConfirmDialogProps
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Inherited children attribute accepted by ConfirmDialog. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Inherited sx attribute accepted by ConfirmDialog. |
id | string | No | Inherited id attribute accepted by ConfirmDialog. |
role | string | No | Inherited role attribute accepted by ConfirmDialog. |
style | Record<string, unknown> | No | Inherited style attribute accepted by ConfirmDialog. |
title | string & Child | No | Configures title for this component. |
tabIndex | number | No | Inherited tabIndex attribute accepted by ConfirmDialog. |
hidden | boolean | No | Inherited hidden attribute accepted by ConfirmDialog. |
disabled | boolean | No | Inherited disabled attribute accepted by ConfirmDialog. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by ConfirmDialog. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by ConfirmDialog. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by ConfirmDialog. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by ConfirmDialog. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by ConfirmDialog. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by ConfirmDialog. |
open | boolean | No | Configures open for this component. |
description | Child | No | Configures description for this component. |
confirmLabel | Child | No | Configures confirmLabel for this component. |
cancelLabel | Child | No | Configures cancelLabel for this component. |
tone | "danger" | "primary" | No | Configures tone for this component. |
onConfirm | () => void | No | Configures onConfirm for this component. |
onCancel | () => void | No | Configures onCancel for this component. |
State ownership and DOM target
| Concern | Contract |
|---|---|
| State | Application controlled through open and the matching callback. |
| DOM target | Public passthrough props target the component root. Treat nested elements and private class names as implementation details. |
Anatomy and related components
Limitations
Avoid ConfirmDialog when using feedback components as primary page layout.
Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.
Accessibility
Built on `Dialog`, so it inherits modal roles, escape behavior, and focus trapping.
Built on `Dialog`, so it inherits modal roles, escape behavior, and focus trapping.
Component status
| Contract | Current value |
|---|---|
| Maturity | stable |
| Category | feedback |
| Component import | @tavojs/ui/confirm-dialog |
| Explicit CSS import | @tavojs/ui/css/confirm-dialog |
| Preview | Interactive preview available on this page |