Reference headless
dialog
# CreateDialogOptions
Members
closeOnEscape?optional closeOnEscape?: boolean###### Inherited from
CreateDialogInput.closeOnEscapecloseOnOutsideClick?optional closeOnOutsideClick?: boolean###### Inherited from
CreateDialogInput.closeOnOutsideClickdefaultOpen?optional defaultOpen?: boolean###### Inherited from
CreateDialogInput.defaultOpenid?optional id?: stringmodal?optional modal?: boolean###### Inherited from
CreateDialogInput.modalonOpenChange?optional onOpenChange?: (open) => void###### Parameters
###### open
boolean###### Returns
voidrequireTitle?optional requireTitle?: booleanIf true, the title attachment is required for the content to label itself. Defaults true — APG mandates an accessible name for modal dialogs. The Layer 4 component enforces this at the type level.
# DialogContext
Members
closeOnEscapecloseOnEscape: booleancloseOnOutsideClickcloseOnOutsideClick: booleanmodalmodal: boolean
# DialogController
Members
closereadonly close: Attachmentcontentreadonly content: AttachmentcontentIdreadonly contentId: stringcontextreadonly context: Readonly<DialogContext>descriptionreadonly description: AttachmentdescriptionIdreadonly descriptionId: stringidreadonly id: stringmachinereadonly machine: DialogMachineopenreadonly open: booleanoverlayreadonly overlay: Attachmentstatereadonly state: DialogStatetitlereadonly title: AttachmenttitleIdreadonly titleId: stringtriggerreadonly trigger: AttachmenttriggerIdreadonly triggerId: stringDOM ids for ARIA wiring.
hide()hide(): void###### Returns
voidsetCloseOnEscape()setCloseOnEscape(value): void###### Parameters
###### value
boolean###### Returns
voidsetCloseOnOutsideClick()setCloseOnOutsideClick(value): void###### Parameters
###### value
boolean###### Returns
voidsetModal()setModal(modal): void###### Parameters
###### modal
boolean###### Returns
voidsetOpen()setOpen(open): void###### Parameters
###### open
boolean###### Returns
voidshow()show(): void###### Returns
voidsubscribe()subscribe(listener): () => void###### Parameters
###### listener
(
snapshot) =>void###### Returns
() =>
voidtoggle()toggle(): void###### Returns
void
# Attachment
Attachment = (node) => void | (() => void)Parameters
nodeHTMLElement
Returns
void | (() => void)# DialogEvent
DialogEvent = { type: "OPEN"; } | { type: "CLOSE"; } | { type: "TOGGLE"; } | { open: boolean; type: "SET.OPEN"; } | { type: "ESCAPE"; } | { type: "OUTSIDE_CLICK"; } | { modal: boolean; type: "SET.MODAL"; } | { type: "SET.CLOSE_ON_ESCAPE"; value: boolean; } | { type: "SET.CLOSE_ON_OUTSIDE_CLICK"; value: boolean; }# DialogMachine
DialogMachine = Machine<DialogContext, DialogEvent, DialogState># DialogState
DialogState = "closed" | "open"# createDialog ( )
createDialog(options?): DialogControllerCreate a Dialog controller plus its six attachment factories.
Parameters
options?CreateDialogOptions = {}
Returns
DialogController