Skip to content
UI

Dialog

A window overlaid on either the primary window or another dialog window, rendering the content underneath inert.

<script setup lang="ts">
import { Dialog } from '@destyler-ui/vue'
</script>

<template>
  <Dialog.Root>
    <Dialog.Trigger>Open Dialog</Dialog.Trigger>
    <Teleport to="body">
      <Dialog.Backdrop />
      <Dialog.Positioner data-testid="positioner">
        <Dialog.Content>
          <Dialog.Title>Dialog Title</Dialog.Title>
          <Dialog.Description>Dialog Description</Dialog.Description>
          <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
        </Dialog.Content>
      </Dialog.Positioner>
    </Teleport>
  </Dialog.Root>
</template>
import { createPortal } from 'react-dom'
import { Dialog } from '@destyler-ui/react'

export function Basic(props: Dialog.RootProps) {
  return (
    <Dialog.Root {...props}>
      <Dialog.Trigger>Open Dialog</Dialog.Trigger>
      {createPortal(
        <>
          <Dialog.Backdrop />
          <Dialog.Positioner data-testid="positioner">
            <Dialog.Content>
              <Dialog.Title>Dialog Title</Dialog.Title>
              <Dialog.Description>Dialog Description</Dialog.Description>
              <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
            </Dialog.Content>
          </Dialog.Positioner>
        </>,
        document.body,
      )}
    </Dialog.Root>
  )
}
import { Dialog } from '@destyler-ui/solid/dialog'
import { Portal } from 'solid-js/web'

export function Basic() {
  return (
    <Dialog.Root open>
      <Dialog.Trigger>Open Dialog</Dialog.Trigger>
      <Portal>
        <Dialog.Backdrop />
        <Dialog.Positioner>
          <Dialog.Content>
            <Dialog.Title>Dialog Title</Dialog.Title>
            <Dialog.Description>Dialog Description</Dialog.Description>
            <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
          </Dialog.Content>
        </Dialog.Positioner>
      </Portal>
    </Dialog.Root>
  )
}
<script lang="ts">
  import type { DialogRootProps } from '@destyler-ui/svelte'
  import { portal } from '@destyler-ui/svelte'
  import { Dialog } from '@destyler-ui/svelte'

  const props: DialogRootProps = $props()
</script>

<Dialog.Root {...props}>
  <Dialog.Trigger>Open Dialog</Dialog.Trigger>
  <div use:portal>
    <Dialog.Backdrop />
    <Dialog.Positioner data-testid="positioner">
      <Dialog.Content>
        <Dialog.Title>Dialog Title</Dialog.Title>
        <Dialog.Description>Dialog Description</Dialog.Description>
        <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
      </Dialog.Content>
    </Dialog.Positioner>
  </div>
</Dialog.Root>
<script setup lang="ts">
import { Dialog } from '@destyler-ui/vue'
</script>
<template>
<Dialog.Root>
<Dialog.Trigger />
<Dialog.Backdrop />
<Dialog.Positioner>
<Dialog.Content>
<Dialog.Title />
<Dialog.Description />
<Dialog.CloseTrigger />
</Dialog.Content>
</Dialog.Positioner>
</Dialog.Root>
</template>
import { Dialog } from '@destyler-ui/react'
export default function Basic() {
return (
<Dialog.Root>
<Dialog.Trigger />
<Dialog.Backdrop />
<Dialog.Positioner>
<Dialog.Content>
<Dialog.Title />
<Dialog.Description />
<Dialog.CloseTrigger />
</Dialog.Content>
</Dialog.Positioner>
</Dialog.Root>
)
}
import { Dialog } from '@destyler-ui/solid'
export default function Basic() {
return (
<Dialog.Root>
<Dialog.Trigger />
<Dialog.Backdrop />
<Dialog.Positioner>
<Dialog.Content>
<Dialog.Title />
<Dialog.Description />
<Dialog.CloseTrigger />
</Dialog.Content>
</Dialog.Positioner>
</Dialog.Root>
)
}
<script lang="ts">
import { Dialog, portal } from '@destyler-ui/svelte'
</script>
<Dialog.Root>
<Dialog.Trigger>Open dialog</Dialog.Trigger>
<div use:portal>
<Dialog.Backdrop />
<Dialog.Positioner>
<Dialog.Content>
<Dialog.Title>Dialog title</Dialog.Title>
<Dialog.Description>Dialog description</Dialog.Description>
<Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
</Dialog.Content>
</Dialog.Positioner>
</div>
</Dialog.Root>
<script setup lang="ts">
import { Dialog } from '@destyler-ui/vue'
</script>

<template>
  <Dialog.Root>
    <Dialog.Trigger>Open Dialog</Dialog.Trigger>
    <Teleport to="body">
      <Dialog.Backdrop />
      <Dialog.Positioner data-testid="positioner">
        <Dialog.Content>
          <Dialog.Title>Dialog Title</Dialog.Title>
          <Dialog.Description>Dialog Description</Dialog.Description>
          <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
        </Dialog.Content>
      </Dialog.Positioner>
    </Teleport>
  </Dialog.Root>
</template>
import { createPortal } from 'react-dom'
import { Dialog } from '@destyler-ui/react'

export function Basic(props: Dialog.RootProps) {
  return (
    <Dialog.Root {...props}>
      <Dialog.Trigger>Open Dialog</Dialog.Trigger>
      {createPortal(
        <>
          <Dialog.Backdrop />
          <Dialog.Positioner data-testid="positioner">
            <Dialog.Content>
              <Dialog.Title>Dialog Title</Dialog.Title>
              <Dialog.Description>Dialog Description</Dialog.Description>
              <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
            </Dialog.Content>
          </Dialog.Positioner>
        </>,
        document.body,
      )}
    </Dialog.Root>
  )
}
import { Dialog } from '@destyler-ui/solid/dialog'
import { Portal } from 'solid-js/web'

export function Basic() {
  return (
    <Dialog.Root open>
      <Dialog.Trigger>Open Dialog</Dialog.Trigger>
      <Portal>
        <Dialog.Backdrop />
        <Dialog.Positioner>
          <Dialog.Content>
            <Dialog.Title>Dialog Title</Dialog.Title>
            <Dialog.Description>Dialog Description</Dialog.Description>
            <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
          </Dialog.Content>
        </Dialog.Positioner>
      </Portal>
    </Dialog.Root>
  )
}
<script lang="ts">
  import type { DialogRootProps } from '@destyler-ui/svelte'
  import { portal } from '@destyler-ui/svelte'
  import { Dialog } from '@destyler-ui/svelte'

  const props: DialogRootProps = $props()
</script>

<Dialog.Root {...props}>
  <Dialog.Trigger>Open Dialog</Dialog.Trigger>
  <div use:portal>
    <Dialog.Backdrop />
    <Dialog.Positioner data-testid="positioner">
      <Dialog.Content>
        <Dialog.Title>Dialog Title</Dialog.Title>
        <Dialog.Description>Dialog Description</Dialog.Description>
        <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
      </Dialog.Content>
    </Dialog.Positioner>
  </div>
</Dialog.Root>

Control the open state of the dialog programmatically.

<script setup lang="ts">
import { Dialog } from '@destyler-ui/vue'
import { ref } from 'vue'

const open = ref(false)
</script>

<template>
  <button @click="() => (open = true)">Open Dialog</button>
  <Dialog.Root v-model:open="open">
    <Teleport to="body">
      <Dialog.Backdrop />
      <Dialog.Positioner>
        <Dialog.Content>
          <Dialog.Title>Dialog Title</Dialog.Title>
          <Dialog.Description>Dialog Description</Dialog.Description>
          <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
        </Dialog.Content>
      </Dialog.Positioner>
    </Teleport>
  </Dialog.Root>
</template>
import { useState } from 'react'
import { createPortal } from 'react-dom'
import { Dialog } from '@destyler-ui/react'

export function Controlled() {
  const [open, setOpen] = useState(false)

  return (
    <>
      <button onClick={() => setOpen(true)}>Open Dialog</button>
      <Dialog.Root open={open} onOpenChange={({ open }) => setOpen(open)}>
        {createPortal(
          <>
            <Dialog.Backdrop />
            <Dialog.Positioner>
              <Dialog.Content>
                <Dialog.Title>Dialog Title</Dialog.Title>
                <Dialog.Description>Dialog Description</Dialog.Description>
                <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
              </Dialog.Content>
            </Dialog.Positioner>
          </>,
          document.body,
        )}
      </Dialog.Root>
    </>
  )
}
import { Dialog } from '@destyler-ui/solid/dialog'
import { createSignal } from 'solid-js'
import { Portal } from 'solid-js/web'

export function Controlled() {
  const [isOpen, setIsOpen] = createSignal(false)

  return (
    <>
      <button type="button" onClick={() => setIsOpen(true)}>
        Open Dialog
      </button>
      <Dialog.Root open={isOpen()} onOpenChange={() => setIsOpen(false)}>
        <Portal>
          <Dialog.Backdrop />
          <Dialog.Positioner>
            <Dialog.Content>
              <Dialog.Title>Dialog Title</Dialog.Title>
              <Dialog.Description>Dialog Description</Dialog.Description>
              <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
            </Dialog.Content>
          </Dialog.Positioner>
        </Portal>
      </Dialog.Root>
    </>
  )
}
<script lang="ts">
  import { portal } from '@destyler-ui/svelte'
  import { Dialog } from '@destyler-ui/svelte'

  let open = $state(false)
</script>

<button onclick={() => open = true}>Open Dialog</button>
<Dialog.Root bind:open>
  <div use:portal>
    <Dialog.Backdrop />
    <Dialog.Positioner>
      <Dialog.Content>
        <Dialog.Title>Dialog Title</Dialog.Title>
        <Dialog.Description>Dialog Description</Dialog.Description>
        <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
      </Dialog.Content>
    </Dialog.Positioner>
  </div>
</Dialog.Root>

Open the dialog by default with defaultOpen.

<script setup lang="ts">
import { Dialog } from '@destyler-ui/vue'
</script>

<template>
 <Dialog.Root defaultOpen>
    <Dialog.Trigger>Open Dialog</Dialog.Trigger>
    <Teleport to="body">
      <Dialog.Backdrop />
      <Dialog.Positioner data-testid="positioner">
        <Dialog.Content>
          <Dialog.Title>Dialog Title</Dialog.Title>
          <Dialog.Description>Dialog Description</Dialog.Description>
          <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
        </Dialog.Content>
      </Dialog.Positioner>
    </Teleport>
  </Dialog.Root>
</template>
import { createPortal } from 'react-dom'
import { Dialog } from '@destyler-ui/react'

export function InitialOpen(props: Dialog.RootProps) {
  return (
    <Dialog.Root {...props} defaultOpen>
      <Dialog.Trigger>Open Dialog</Dialog.Trigger>
      {createPortal(
        <>
          <Dialog.Backdrop />
          <Dialog.Positioner data-testid="positioner">
            <Dialog.Content>
              <Dialog.Title>Dialog Title</Dialog.Title>
              <Dialog.Description>Dialog Description</Dialog.Description>
              <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
            </Dialog.Content>
          </Dialog.Positioner>
        </>,
        document.body,
      )}
    </Dialog.Root>
  )
}
import { Dialog } from '@destyler-ui/solid/dialog'
import { Portal } from 'solid-js/web'

export function InitialOpen() {
  return (
    <Dialog.Root defaultOpen>
      <Dialog.Trigger>Open Dialog</Dialog.Trigger>
      <Portal>
        <Dialog.Backdrop />
        <Dialog.Positioner>
          <Dialog.Content>
            <Dialog.Title>Dialog Title</Dialog.Title>
            <Dialog.Description>Dialog Description</Dialog.Description>
            <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
          </Dialog.Content>
        </Dialog.Positioner>
      </Portal>
    </Dialog.Root>
  )
}
<script lang="ts">
  import type { DialogRootProps } from '@destyler-ui/svelte'
  import { portal } from '@destyler-ui/svelte'
  import { Dialog } from '@destyler-ui/svelte'

  const props: DialogRootProps = $props()
</script>

<Dialog.Root {...props} defaultOpen>
  <Dialog.Trigger>Open Dialog</Dialog.Trigger>
  <div use:portal>
    <Dialog.Backdrop />
    <Dialog.Positioner data-testid="positioner">
      <Dialog.Content>
        <Dialog.Title>Dialog Title</Dialog.Title>
        <Dialog.Description>Dialog Description</Dialog.Description>
        <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
      </Dialog.Content>
    </Dialog.Positioner>
  </div>
</Dialog.Root>

Mount the dialog content lazily when first opened.

<script setup lang="ts">
import { Dialog } from '@destyler-ui/vue'
</script>

<template>
  <Dialog.Root lazyMount unmountOnExit>
    <Dialog.Trigger>Open Dialog</Dialog.Trigger>
    <Dialog.Backdrop />
    <Dialog.Positioner>
      <Dialog.Content>
        <Dialog.Title>Dialog Title</Dialog.Title>
        <Dialog.Description>Dialog Description</Dialog.Description>
        <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
      </Dialog.Content>
    </Dialog.Positioner>
  </Dialog.Root>
</template>
import { Dialog } from '@destyler-ui/react'

export function LazyMount() {
  return (
    <Dialog.Root lazyMount unmountOnExit>
      <Dialog.Trigger>Open Dialog</Dialog.Trigger>
      <Dialog.Backdrop />
      <Dialog.Positioner>
        <Dialog.Content>
          <Dialog.Title>Dialog Title</Dialog.Title>
          <Dialog.Description>Dialog Description</Dialog.Description>
          <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
        </Dialog.Content>
      </Dialog.Positioner>
    </Dialog.Root>
  )
}
import { Dialog } from '@destyler-ui/solid/dialog'

export function LazyMount() {
  return (
    <Dialog.Root lazyMount unmountOnExit>
      <Dialog.Trigger>Open Dialog</Dialog.Trigger>
      <Dialog.Backdrop />
      <Dialog.Positioner>
        <Dialog.Content>
          <Dialog.Title>Dialog Title</Dialog.Title>
          <Dialog.Description>Dialog Description</Dialog.Description>
          <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
        </Dialog.Content>
      </Dialog.Positioner>
    </Dialog.Root>
  )
}
<script lang="ts">
  import { Dialog } from '@destyler-ui/svelte'
</script>

<Dialog.Root lazyMount unmountOnExit>
  <Dialog.Trigger>Open Dialog</Dialog.Trigger>
  <Dialog.Backdrop />
  <Dialog.Positioner>
    <Dialog.Content>
      <Dialog.Title>Dialog Title</Dialog.Title>
      <Dialog.Description>Dialog Description</Dialog.Description>
      <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
    </Dialog.Content>
  </Dialog.Positioner>
</Dialog.Root>

Use render function for custom dialog rendering.

<script setup lang="ts">
import { Dialog } from '@destyler-ui/vue'
</script>

<template>
  <Dialog.Root>
    <Dialog.Trigger>Open Dialog</Dialog.Trigger>
    <Teleport to="body">
      <Dialog.Backdrop />
      <Dialog.Positioner>
        <Dialog.Content>
          <Dialog.Title>Dialog Title</Dialog.Title>
          <Dialog.Description>Dialog Description</Dialog.Description>
          <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
        </Dialog.Content>
      </Dialog.Positioner>
    </Teleport>
    <Dialog.Context v-slot="dialog">
      <p>Dialog is {{ dialog.open ? 'open' : 'closed' }}</p>
    </Dialog.Context>
  </Dialog.Root>
</template>
import { createPortal } from 'react-dom'
import { Dialog } from '@destyler-ui/react'

export function RenderFn() {
  return (
    <Dialog.Root>
      <Dialog.Trigger>Open Dialog</Dialog.Trigger>
      {createPortal(
        <>
          <Dialog.Backdrop />
          <Dialog.Positioner>
            <Dialog.Content>
              <Dialog.Title>Dialog Title</Dialog.Title>
              <Dialog.Description>Dialog Description</Dialog.Description>
              <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
            </Dialog.Content>
          </Dialog.Positioner>
        </>,
        document.body,
      )}
      <Dialog.Context>
        {dialog => <p>Dialog is {dialog.open ? 'open' : 'closed'}</p>}
      </Dialog.Context>
    </Dialog.Root>
  )
}
import { Dialog } from '@destyler-ui/solid/dialog'
import { Portal } from 'solid-js/web'

export function RenderFn() {
  return (
    <Dialog.Root>
      <Dialog.Trigger>Open Dialog</Dialog.Trigger>
      <Portal>
        <Dialog.Backdrop />
        <Dialog.Positioner>
          <Dialog.Content>
            <Dialog.Title>Dialog Title</Dialog.Title>
            <Dialog.Description>Dialog Description</Dialog.Description>
            <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
          </Dialog.Content>
        </Dialog.Positioner>
      </Portal>
      <Dialog.Context>
        {context => <p>Dialog is {context().open ? 'open' : 'closed'}</p>}
      </Dialog.Context>
    </Dialog.Root>
  )
}
<script lang="ts">
  import { portal } from '@destyler-ui/svelte'
  import { Dialog } from '@destyler-ui/svelte'
</script>

<Dialog.Root>
  <Dialog.Trigger>Open Dialog</Dialog.Trigger>
  <div use:portal>
    <Dialog.Backdrop />
    <Dialog.Positioner>
      <Dialog.Content>
        <Dialog.Title>Dialog Title</Dialog.Title>
        <Dialog.Description>Dialog Description</Dialog.Description>
        <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
      </Dialog.Content>
    </Dialog.Positioner>
  </div>
  <Dialog.Context>
    {#snippet children(dialog)}
      <p>Dialog is {dialog().open ? 'open' : 'closed'}</p>
    {/snippet}
  </Dialog.Context>
</Dialog.Root>
<script setup lang="ts">
import { Dialog, useDialog } from '@destyler-ui/vue'

const dialog = useDialog()
</script>

<template>
  <button @click="dialog.setOpen(true)">Open</button>

  <Dialog.RootProvider :value="dialog">
    <Dialog.Trigger>Open Dialog</Dialog.Trigger>
    <Teleport to="body">
      <Dialog.Backdrop />
      <Dialog.Positioner>
        <Dialog.Content>
          <Dialog.Title>Dialog Title</Dialog.Title>
          <Dialog.Description>Dialog Description</Dialog.Description>
          <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
        </Dialog.Content>
      </Dialog.Positioner>
    </Teleport>
  </Dialog.RootProvider>
</template>
import { createPortal } from 'react-dom'
import { Dialog, useDialog } from '@destyler-ui/react'

export function RootProvider() {
  const dialog = useDialog()

  return (
    <>
      <button onClick={() => dialog.setOpen(true)}>Open</button>

      <Dialog.RootProvider value={dialog}>
        <Dialog.Trigger>Open Dialog</Dialog.Trigger>
        {createPortal(
          <>
            <Dialog.Backdrop />
            <Dialog.Positioner>
              <Dialog.Content>
                <Dialog.Title>Dialog Title</Dialog.Title>
                <Dialog.Description>Dialog Description</Dialog.Description>
                <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
              </Dialog.Content>
            </Dialog.Positioner>
          </>,
          document.body,
        )}
      </Dialog.RootProvider>
    </>
  )
}
import { Dialog, useDialog } from '@destyler-ui/solid/dialog'
import { Portal } from 'solid-js/web'

export function RootProvider() {
  const dialog = useDialog()

  return (
    <>
      <button onClick={() => dialog().setOpen(true)}>Open</button>

      <Dialog.RootProvider value={dialog}>
        <Dialog.Trigger>Open Dialog</Dialog.Trigger>
        <Portal>
          <Dialog.Backdrop />
          <Dialog.Positioner>
            <Dialog.Content>
              <Dialog.Title>Dialog Title</Dialog.Title>
              <Dialog.Description>Dialog Description</Dialog.Description>
              <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
            </Dialog.Content>
          </Dialog.Positioner>
        </Portal>
      </Dialog.RootProvider>
    </>
  )
}
<script lang="ts">
  import { portal } from '@destyler-ui/svelte'
  import { Dialog, useDialog } from '@destyler-ui/svelte'

  const id = $props.id()
  const dialog = useDialog({ id })
</script>

<button onclick={() => dialog().setOpen(true)}>Open</button>
<Dialog.RootProvider value={dialog}>
  <Dialog.Trigger>Open Dialog</Dialog.Trigger>
  <div use:portal>
    <Dialog.Backdrop />
    <Dialog.Positioner>
      <Dialog.Content>
        <Dialog.Title>Dialog Title</Dialog.Title>
        <Dialog.Description>Dialog Description</Dialog.Description>
        <Dialog.CloseTrigger>Close</Dialog.CloseTrigger>
      </Dialog.Content>
    </Dialog.Positioner>
  </div>
</Dialog.RootProvider>

Root

PropDefaultType
aria-label—string

Human readable label for the dialog, in event the dialog title is not rendered

closeOnEscapetruefalse | true

Whether to close the dialog when the escape key is pressed

closeOnInteractOutsidetruefalse | true

Whether to close the dialog when the outside is clicked

defaultOpen—false | true

The initial open state of the dialog when it is first rendered. Use when you do not need to control its open state.

finalFocusEl—() => HTMLElement

Element to receive focus when the dialog is closed

id—string

The unique identifier of the machine.

ids—Partial<{ trigger: string; positioner: string; backdrop: string; content: string; closeTrigger: string; title: string; description: string; }>

The ids of the elements in the dialog. Useful for composition.

initialFocusEl—() => HTMLElement

Element to receive focus when the dialog is opened

lazyMountfalsefalse | true

Whether to enable lazy mounting

modaltruefalse | true

Whether to prevent pointer interaction outside the element and hide all content below it

open—false | true

Whether the dialog is open

persistentElements—(() => Element)[]

Returns the persistent elements that: - should not have pointer-events disabled - should not trigger the dismiss event

preventScrolltruefalse | true

Whether to prevent scrolling behind the dialog when it's opened

restoreFocus—false | true

Whether to restore focus to the element that had focus before the dialog was opened

role"dialog""dialog" | "alertdialog"

The dialog's role

trapFocustruefalse | true

Whether to trap focus inside the dialog when it's opened

unmountOnExitfalsefalse | true

Whether to unmount on exit.

EmitEvent
escapeKeyDown[event: KeyboardEvent]

Function called when the escape key is pressed

focusOutside[event: FocusOutsideEvent]

Function called when the focus is moved outside the component

interactOutside[event: InteractOutsideEvent]

Function called when an interaction happens outside the component

openChange[details: OpenChangeDetails]

Callback to be invoked when the dialog is opened or closed

pointerDownOutside[event: PointerDownOutsideEvent]

Function called when the pointer is pressed down outside the component

update:open[open: boolean]

Backdrop

PropDefaultType
asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

CloseTrigger

PropDefaultType
asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

Content

PropDefaultType
asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

Context

No serializable props or emits are declared for this part.

Description

PropDefaultType
asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

Positioner

PropDefaultType
asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

RootProvider

PropDefaultType
value*—MachineApi<PropTypes>
lazyMountfalsefalse | true

Whether to enable lazy mounting

unmountOnExitfalsefalse | true

Whether to unmount on exit.

Title

PropDefaultType
asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

Trigger

PropDefaultType
asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

Root

PropDefaultType
aria-label—string

Human readable label for the dialog, in event the dialog title is not rendered

asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

closeOnEscapetruefalse | true

Whether to close the dialog when the escape key is pressed

closeOnInteractOutsidetruefalse | true

Whether to close the dialog when the outside is clicked

defaultOpen—false | true

The initial open state of the dialog when it is first rendered. Use when you do not need to control its open state.

finalFocusEl—() => HTMLElement | null

Element to receive focus when the dialog is closed

id—string

The unique identifier of the machine.

ids—Partial<{ trigger: string; positioner: string; backdrop: string; content: string; closeTrigger: string; title: string; description: string; }>

The ids of the elements in the dialog. Useful for composition.

immediate—false | true

Whether to synchronize the present change immediately or defer it to the next frame

initialFocusEl—() => HTMLElement | null

Element to receive focus when the dialog is opened

lazyMountfalsefalse | true

Whether to enable lazy mounting

modaltruefalse | true

Whether to prevent pointer interaction outside the element and hide all content below it

onEscapeKeyDown—(event: KeyboardEvent) => void

Function called when the escape key is pressed

onExitComplete—() => void

Function called when the animation ends in the closed state

onFocusOutside—(event: calendar.FocusOutsideEvent) => void

Function called when the focus is moved outside the component

onInteractOutside—(event: calendar.InteractOutsideEvent) => void

Function called when an interaction happens outside the component

onOpenChange—(details: dialog.OpenChangeDetails) => void

Callback to be invoked when the dialog is opened or closed

onPointerDownOutside—(event: calendar.PointerDownOutsideEvent) => void

Function called when the pointer is pressed down outside the component

open—false | true

Whether the dialog is open

persistentElements—(() => Element | null)[]

Returns the persistent elements that: - should not have pointer-events disabled - should not trigger the dismiss event

present—false | true

Whether the node is present (controlled by the user)

preventScrolltruefalse | true

Whether to prevent scrolling behind the dialog when it's opened

restoreFocus—false | true

Whether to restore focus to the element that had focus before the dialog was opened

role"dialog""dialog" | "alertdialog"

The dialog's role

trapFocustruefalse | true

Whether to trap focus inside the dialog when it's opened

unmountOnExitfalsefalse | true

Whether to unmount on exit.

Backdrop

PropDefaultType
asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

CloseTrigger

PropDefaultType
asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

Content

PropDefaultType
asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

Context

PropDefaultType
children*—(context: UseDialogContext) => ReactNode

Description

PropDefaultType
asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

Positioner

PropDefaultType
asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

RootProvider

PropDefaultType
value*—UseDialogReturn
asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

immediate—false | true

Whether to synchronize the present change immediately or defer it to the next frame

lazyMountfalsefalse | true

Whether to enable lazy mounting

onExitComplete—() => void

Function called when the animation ends in the closed state

present—false | true

Whether the node is present (controlled by the user)

unmountOnExitfalsefalse | true

Whether to unmount on exit.

Title

PropDefaultType
asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

Trigger

PropDefaultType
asChild—false | true

Use the provided child element as the default rendered element, combining their props and behavior.

Root

PropDefaultType
aria-label—string

Human readable label for the dialog, in event the dialog title is not rendered

children—null | number | false | true | Node | JSX.ArrayElement | (string & {})
closeOnEscapetruefalse | true

Whether to close the dialog when the escape key is pressed

closeOnInteractOutsidetruefalse | true

Whether to close the dialog when the outside is clicked

defaultOpen—false | true

The initial open state of the dialog when it is first rendered. Use when you do not need to control its open state.

finalFocusEl—() => HTMLElement | null

Element to receive focus when the dialog is closed

id—string

The unique identifier of the machine.

ids—Partial<{ trigger: string; positioner: string; backdrop: string; content: string; closeTrigger: string; title: string; description: string; }>

The ids of the elements in the dialog. Useful for composition.

immediate—false | true

Whether to synchronize the present change immediately or defer it to the next frame

initialFocusEl—() => HTMLElement | null

Element to receive focus when the dialog is opened

lazyMountfalsefalse | true

Whether to enable lazy mounting

modaltruefalse | true

Whether to prevent pointer interaction outside the element and hide all content below it

onEscapeKeyDown—(event: KeyboardEvent) => void

Function called when the escape key is pressed

onExitComplete—() => void

Function called when the animation ends in the closed state

onFocusOutside—(event: dialog.FocusOutsideEvent) => void

Function called when the focus is moved outside the component

onInteractOutside—(event: dialog.InteractOutsideEvent) => void

Function called when an interaction happens outside the component

onOpenChange—(details: OpenChangeDetails) => void

Callback to be invoked when the dialog is opened or closed

onPointerDownOutside—(event: dialog.PointerDownOutsideEvent) => void

Function called when the pointer is pressed down outside the component

open—false | true

Whether the dialog is open

persistentElements—(() => Element | null)[]

Returns the persistent elements that: - should not have pointer-events disabled - should not trigger the dismiss event

present—false | true

Whether the node is present (controlled by the user)

preventScrolltruefalse | true

Whether to prevent scrolling behind the dialog when it's opened

restoreFocus—false | true

Whether to restore focus to the element that had focus before the dialog was opened

role"dialog""dialog" | "alertdialog"

The dialog's role

trapFocustruefalse | true

Whether to trap focus inside the dialog when it's opened

unmountOnExitfalsefalse | true

Whether to unmount on exit.

Backdrop

PropDefaultType
asChild—(props: (userProps?: JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

CloseTrigger

PropDefaultType
asChild—(props: (userProps?: JSX.ButtonHTMLAttributes<HTMLButtonElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Content

PropDefaultType
asChild—(props: (userProps?: JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Context

PropDefaultType
children*—(context: UseDialogContext) => Element

Description

PropDefaultType
asChild—(props: (userProps?: JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Positioner

PropDefaultType
asChild—(props: (userProps?: JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

RootProvider

PropDefaultType
value*—UseDialogReturn
children—null | number | false | true | Node | JSX.ArrayElement | (string & {})
immediate—false | true

Whether to synchronize the present change immediately or defer it to the next frame

lazyMountfalsefalse | true

Whether to enable lazy mounting

onExitComplete—() => void

Function called when the animation ends in the closed state

present—false | true

Whether the node is present (controlled by the user)

unmountOnExitfalsefalse | true

Whether to unmount on exit.

Title

PropDefaultType
asChild—(props: (userProps?: JSX.HTMLAttributes<HTMLHeadingElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Trigger

PropDefaultType
asChild—(props: (userProps?: JSX.ButtonHTMLAttributes<HTMLButtonElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Root

PropDefaultType
aria-label—string

Human readable label for the dialog, in event the dialog title is not rendered

children—Snippet<[]> | undefined
closeOnEscapetruefalse | true

Whether to close the dialog when the escape key is pressed

closeOnInteractOutsidetruefalse | true

Whether to close the dialog when the outside is clicked

defaultOpen—false | true

The initial open state of the dialog when it is not controlled. Prefer this over seeding with `open` for uncontrolled usage.

finalFocusEl—() => HTMLElement | null

Element to receive focus when the dialog is closed

id—string
ids—Partial<{ trigger: string; positioner: string; backdrop: string; content: string; closeTrigger: string; title: string; description: string; }>

The ids of the elements in the dialog. Useful for composition.

immediate—false | true

Whether to synchronize the present change immediately or defer it to the next frame

initialFocusEl—() => HTMLElement | null

Element to receive focus when the dialog is opened

lazyMountfalsefalse | true

Whether to enable lazy mounting

modaltruefalse | true

Whether to prevent pointer interaction outside the element and hide all content below it

onEscapeKeyDown—(event: KeyboardEvent) => void

Function called when the escape key is pressed

onExitComplete—() => void

Function called when the animation ends in the closed state

onFocusOutside—(event: import("@destyler/calendar").FocusOutsideEvent) => void

Function called when the focus is moved outside the component

onInteractOutside—(event: import("@destyler/calendar").InteractOutsideEvent) => void

Function called when an interaction happens outside the component

onOpenChange—(details: import("@destyler/dialog").OpenChangeDetails) => void

Callback to be invoked when the dialog is opened or closed

onPointerDownOutside—(event: import("@destyler/calendar").PointerDownOutsideEvent) => void

Function called when the pointer is pressed down outside the component

open—false | true

Whether the dialog is open

persistentElements—(() => Element | null)[]

Returns the persistent elements that: - should not have pointer-events disabled - should not trigger the dismiss event

present—false | true

Whether the node is present (controlled by the user)

preventScrolltruefalse | true

Whether to prevent scrolling behind the dialog when it's opened

restoreFocus—false | true

Whether to restore focus to the element that had focus before the dialog was opened

role"dialog""dialog" | "alertdialog"

The dialog's role

skipAnimationOnMountfalsefalse | true

Whether to allow the initial presence animation.

trapFocustruefalse | true

Whether to trap focus inside the dialog when it's opened

unmountOnExitfalsefalse | true

Whether to unmount on exit.

Backdrop

PropDefaultType
asChild—import("svelte").Snippet<[import("../../../types.js").PropsFn<"div">]>
children—Snippet<[]> | undefined

CloseTrigger

PropDefaultType
asChild—import("svelte").Snippet<[import("../../../types.js").PropsFn<"button">]>
children—Snippet<[]> | undefined

Content

PropDefaultType
asChild—import("svelte").Snippet<[import("../../../types.js").PropsFn<"div">]>
children—Snippet<[]> | undefined

Context

PropDefaultType
children*—Snippet<[UseDialogContext]>

Description

PropDefaultType
asChild—import("svelte").Snippet<[import("../../../types.js").PropsFn<"p">]>
children—Snippet<[]> | undefined

Positioner

PropDefaultType
asChild—import("svelte").Snippet<[import("../../../types.js").PropsFn<"div">]>
children—Snippet<[]> | undefined

RootProvider

PropDefaultType
value*—UseDialogReturn
asChild—import("svelte").Snippet<[import("../../../types.js").PropsFn<"div">]>
children—Snippet<[]> | undefined
immediate—false | true

Whether to synchronize the present change immediately or defer it to the next frame

lazyMountfalsefalse | true

Whether to enable lazy mounting

onExitComplete—() => void

Function called when the animation ends in the closed state

present—false | true

Whether the node is present (controlled by the user)

skipAnimationOnMountfalsefalse | true

Whether to allow the initial presence animation.

unmountOnExitfalsefalse | true

Whether to unmount on exit.

Title

PropDefaultType
asChild—import("svelte").Snippet<[import("../../../types.js").PropsFn<"h2">]>
children—Snippet<[]> | undefined

Trigger

PropDefaultType
asChild—import("svelte").Snippet<[import("../../../types.js").PropsFn<"button">]>
children—Snippet<[]> | undefined