API reference
@salmonui/overlays/dialog
24 exported symbols: 11 functions, 9 interfaces and 4 types. Each name links its page with the signature, docs and members.
import { … } from '@salmonui/overlays/dialog';Functions
AlertDialogA confirm, alert or prompt dialog (role="alertdialog", .salmon-dialog[data-kind="alert"]).DialogDialog root: the open state, the trigger and the <dialog> (.salmon-dialog).DialogBodyScrolling content region (.salmon-dialog-body).DialogCloseCloses the dialog (reason: 'close'); render swaps the element.DialogDescriptionDescription (<p class="salmon-dialog-description">); describes the dialog.DialogProviderHosts the dialogs of useConfirm() / useAlert() below it: a queue in its own state, at most one alert dialog at a time, nothing on the server.DialogTitleHeading (<h2 class="salmon-dialog-title">); labels the dialog and is the default drag handle.DialogTriggerOpens the dialog (aria-haspopup="dialog", aria-expanded); render swaps the element. Use it in trigger.useAlertawait alert({ title, description }): resolves when the user acknowledges (or on abort).useConfirmawait confirm({ title, description, tone }): true on confirm, false on cancel, Escape or abort.
Interfaces
AlertDialogLocaleTextAlertDialogPropsConfirmOptionsOptions of useConfirm() / useAlert().DialogLocaleTextDialogOpenChangeEventSecond argument of onOpenChange. preventDefault() keeps an uncontrolled dialog as it is.DialogPositionA dialog offset from its placement: x along the inline axis (mirrored in RTL), y down.DialogPropsDialogSizeDialogTriggerProps
Types
DialogOpenChangeReasonDialogPartDialogResizeEdgeLogical resize edges.DialogTriggerRenderPropsProps the trigger computes for its element (spread them in render).