API reference: @salmonui/overlays/dialog
AlertDialogPropsinterface
import type { AlertDialogProps } from '@salmonui/overlays/dialog';interface AlertDialogProps extends Omit<DialogProps, 'title' | 'dismissible' | 'trigger' | 'children' | 'localeText'> {
readonly title: ReactNode;
readonly description?: ReactNode;
readonly children?: ReactNode;
readonly trigger?: ReactNode;
readonly confirmLabel?: ReactNode;
readonly cancelLabel?: ReactNode;
readonly confirmIcon?: ReactNode;
readonly cancelIcon?: ReactNode;
readonly tone?: 'primary' | 'danger' | undefined;
readonly onConfirm?: ((formData: FormData | undefined) => unknown) | undefined;
readonly onCancel?: (() => void) | undefined;
readonly dismissible?: boolean | undefined;
readonly localeText?: AlertDialogLocaleText | undefined;
}
| Name | Signature | Description |
|---|---|---|
title | readonly title: ReactNode; | |
descriptionoptional | readonly description?: ReactNode; | |
childrenoptional | readonly children?: ReactNode; | Form fields (a prompt): the body and actions become a |
triggeroptional | readonly trigger?: ReactNode; | |
confirmLabeloptional | readonly confirmLabel?: ReactNode; | |
cancelLabeloptional | readonly cancelLabel?: ReactNode; | Without a cancel label (and without |
confirmIconoptional | readonly confirmIcon?: ReactNode; | |
cancelIconoptional | readonly cancelIcon?: ReactNode; | |
toneoptional | readonly tone?: 'primary' | 'danger' | undefined; |
|
onConfirmoptional | readonly onConfirm?: ((formData: FormData | undefined) => unknown) | undefined; | May return a promise: the confirm button shows its loading state and the
dialog stays open until it settles. While pending, Cancel is disabled and
Escape and the close button are ignored. A rejection keeps the dialog open
and shows the reason's |
onCanceloptional | readonly onCancel?: (() => void) | undefined; | |
dismissibleoptional | readonly dismissible?: boolean | undefined; | Escape cancels. Default true. |
localeTextoptional | readonly localeText?: AlertDialogLocaleText | undefined; | |
openoptionalinherited | open?: boolean; | |
defaultOpenoptionalinherited | defaultOpen?: boolean; | |
onOpenChangeoptionalinherited | onOpenChange?: ((open: boolean, event: DialogOpenChangeEvent) => void); | |
onAfterOpenoptionalinherited | onAfterOpen?: (() => void); | |
onAfterCloseoptionalinherited | onAfterClose?: (() => void); | |
modaloptionalinherited | modal?: boolean; | showModal() (default) or show() (modeless: no backdrop, no focus containment). |
onOverlayPressoptionalinherited | onOverlayPress?: ((event: PointerEvent) => void); | Press on the backdrop of a modal dialog. |
closeButtonoptionalinherited | closeButton?: boolean; | A close button in the corner (label |
initialFocusoptionalinherited | initialFocus?: false | RefObject<HTMLElement | null>; | Element focused on open (else |
returnFocusoptionalinherited | returnFocus?: boolean; | Return focus to the invoker on close. Default true. |
containeroptionalinherited | container?: Element | null; | Modeless only: render the dialog inside this element (positioned in it) instead of in place. Mounted after hydration. |
keepMountedoptionalinherited | keepMounted?: boolean; | Render the closed |
placementoptionalinherited | placement?: "center" | "top"; |
|
positionoptionalinherited | position?: DialogPosition; | |
defaultPositionoptionalinherited | defaultPosition?: DialogPosition; | |
onPositionChangeoptionalinherited | onPositionChange?: ((position: DialogPosition) => void); | |
widthoptionalinherited | width?: string | number; | |
heightoptionalinherited | height?: string | number; | |
minHeightoptionalinherited | minHeight?: string | number; | |
fullScreenoptionalinherited | fullScreen?: "mobile" | boolean; | Fill the viewport, or only below the mobile width (640 px). |
draggableoptionalinherited | draggable?: boolean; | Drag by |
dragHandleoptionalinherited | dragHandle?: string; | CSS selector of the drag handle inside the dialog. Default |
onMoveStartoptionalinherited | onMoveStart?: (() => void); | |
onMoveoptionalinherited | onMove?: ((position: DialogPosition) => void); | Per animation frame during a drag; not for React state. |
onMoveEndoptionalinherited | onMoveEnd?: ((position: DialogPosition) => void); | |
resizableoptionalinherited | resizable?: boolean | readonly DialogResizeEdge[]; | Resize from |
onResizeStartoptionalinherited | onResizeStart?: (() => void); | |
onResizeoptionalinherited | onResize?: ((size: DialogSize) => void); | |
onResizeEndoptionalinherited | onResizeEnd?: ((size: DialogSize) => void); | |
classNamesoptionalinherited | classNames?: Partial<Record<"closeButton", string>>; | |
stylesoptionalinherited | styles?: Partial<Record<"closeButton", CSSProperties>>; | |
refoptionalinherited | ref?: Ref<HTMLDialogElement>; | The |