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>

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-labelstring

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

defaultOpenfalse | 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

idstring

The unique identifier of the machine.

idsPartial<{ 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

openfalse | 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

restoreFocusfalse | 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
asChildfalse | true

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

CloseTrigger

PropDefaultType
asChildfalse | true

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

Content

PropDefaultType
asChildfalse | 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
asChildfalse | true

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

Positioner

PropDefaultType
asChildfalse | 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
asChildfalse | true

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

Trigger

PropDefaultType
asChildfalse | true

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

Root

PropDefaultType
aria-labelstring

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

asChildfalse | 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

defaultOpenfalse | 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

idstring

The unique identifier of the machine.

idsPartial<{ 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.

immediatefalse | 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

openfalse | 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

presentfalse | true

Whether the node is present (controlled by the user)

preventScrolltruefalse | true

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

restoreFocusfalse | 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
asChildfalse | true

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

CloseTrigger

PropDefaultType
asChildfalse | true

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

Content

PropDefaultType
asChildfalse | true

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

Context

PropDefaultType
children*(context: UseDialogContext) => ReactNode

Description

PropDefaultType
asChildfalse | true

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

Positioner

PropDefaultType
asChildfalse | true

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

RootProvider

PropDefaultType
value*UseDialogReturn
asChildfalse | true

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

immediatefalse | 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

presentfalse | true

Whether the node is present (controlled by the user)

unmountOnExitfalsefalse | true

Whether to unmount on exit.

Title

PropDefaultType
asChildfalse | true

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

Trigger

PropDefaultType
asChildfalse | true

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

Root

PropDefaultType
aria-labelstring

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

childrennull | number | false | true | Node | solid_js118.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

defaultOpenfalse | 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

idstring

The unique identifier of the machine.

idsPartial<{ 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.

immediatefalse | 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

openfalse | 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

presentfalse | true

Whether the node is present (controlled by the user)

preventScrolltruefalse | true

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

restoreFocusfalse | 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?: solid_js118.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?: solid_js118.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?: solid_js118.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?: solid_js118.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?: solid_js118.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
childrennull | number | false | true | Node | solid_js118.JSX.ArrayElement | (string & {})
immediatefalse | 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

presentfalse | true

Whether the node is present (controlled by the user)

unmountOnExitfalsefalse | true

Whether to unmount on exit.

Title

PropDefaultType
asChild(props: (userProps?: solid_js118.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?: solid_js118.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-labelstring

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

childrenSnippet<[]> | 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

defaultOpenfalse | true
finalFocusEl() => HTMLElement | null

Element to receive focus when the dialog is closed

idstring
idsPartial<{ 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.

immediatefalse | 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: FocusOutsideEvent) => void) | undefined

Function called when the focus is moved outside the component

onInteractOutside((event: InteractOutsideEvent) => void) | undefined

Function called when an interaction happens outside the component

onOpenChange(details: import("/home/runner/work/ui/ui/packages/svelte/dist/index").DialogOpenChangeDetails) => void

Callback to be invoked when the dialog is opened or closed

onPointerDownOutside((event: PointerDownOutsideEvent) => void) | undefined

Function called when the pointer is pressed down outside the component

openfalse | 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

presentfalse | true

Whether the node is present (controlled by the user)

preventScrolltruefalse | true

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

restoreFocusfalse | 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
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined

CloseTrigger

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"button">]>
childrenSnippet<[]> | undefined

Content

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined

Context

PropDefaultType
children*Snippet<[UseDialogContext]>

Description

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"p">]>
childrenSnippet<[]> | undefined

Positioner

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined

RootProvider

PropDefaultType
value*UseDialogReturn
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined
immediatefalse | 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

presentfalse | 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
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"h2">]>
childrenSnippet<[]> | undefined

Trigger

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"button">]>
childrenSnippet<[]> | undefined