Navigated to /docs/ui/components/confirm-dialog

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.

TSX
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

Use `ConfirmDialog` for confirmation flows

Choose something else when

Avoid ConfirmDialog when using feedback components as primary page layout.

Examples

ConfirmDialog example

TSX
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

PropTypeDefaultDescription
classNamestring

Optional class hook applied to the public root element owned by the component.
openboolean

Configures open for this component.
titleChild

Configures title for this component.
descriptionChild

Configures description for this component.
confirmLabelChild

Configures confirmLabel for this component.
cancelLabelChild

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

PropertyTypeRequiredDescription
childrenChild

No

Inherited children attribute accepted by ConfirmDialog.

classNamestring

No

Optional class hook applied to the public root element owned by the component.

sxSx

No

Inherited sx attribute accepted by ConfirmDialog.

idstring

No

Inherited id attribute accepted by ConfirmDialog.

rolestring

No

Inherited role attribute accepted by ConfirmDialog.

styleRecord<string, unknown>

No

Inherited style attribute accepted by ConfirmDialog.

titlestring & Child

No

Configures title for this component.

tabIndexnumber

No

Inherited tabIndex attribute accepted by ConfirmDialog.

hiddenboolean

No

Inherited hidden attribute accepted by ConfirmDialog.

disabledboolean

No

Inherited disabled attribute accepted by ConfirmDialog.

onClickTavoEventHandler<MouseEvent>

No

Inherited onClick attribute accepted by ConfirmDialog.

onChangeTavoEventHandler<Event>

No

Inherited onChange attribute accepted by ConfirmDialog.

onInputTavoEventHandler<Event>

No

Inherited onInput attribute accepted by ConfirmDialog.

onKeyDownTavoEventHandler<KeyboardEvent>

No

Inherited onKeyDown attribute accepted by ConfirmDialog.

onFocusTavoEventHandler<FocusEvent>

No

Inherited onFocus attribute accepted by ConfirmDialog.

onBlurTavoEventHandler<FocusEvent>

No

Inherited onBlur attribute accepted by ConfirmDialog.

openboolean

No

Configures open for this component.

descriptionChild

No

Configures description for this component.

confirmLabelChild

No

Configures confirmLabel for this component.

cancelLabelChild

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

ConcernContract
StateApplication controlled through open and the matching callback.
DOM targetPublic passthrough props target the component root. Treat nested elements and private class names as implementation details.

Anatomy and related components

This component exposes one public component root rather than a compound member API.

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

ContractCurrent value
Maturitystable
Categoryfeedback
Component import@tavojs/ui/confirm-dialog
Explicit CSS import@tavojs/ui/css/confirm-dialog
PreviewInteractive preview available on this page