Skip to content

Dialog ​

Styled dialog component family built on zw-dialog primitives.

@zeus-web/dialogFeedbackzweb add dialogGenerated

Playground ​

Source ​

Choose the framework entry that matches your application.

html
<script type="module">
  import '@zeus-web/dialog/wc/auto'
</script>

<zw-dialog>
  <zw-dialog-trigger>Open dialog</zw-dialog-trigger>
  <zw-dialog-content>
    <zw-dialog-title>Publish project?</zw-dialog-title>
    <zw-dialog-description>
      The project will become visible to everyone.
    </zw-dialog-description>
    <zw-dialog-close>Cancel</zw-dialog-close>
  </zw-dialog-content>
</zw-dialog>
tsx
import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogTitle,
  DialogTrigger,
} from '@zeus-web/dialog/react'

export function DialogExample() {
  return (
    <Dialog>
      <DialogTrigger>Open dialog</DialogTrigger>
      <DialogContent>
        <DialogTitle>Publish project?</DialogTitle>
        <DialogDescription>
          The project will become visible to everyone.
        </DialogDescription>
        <DialogClose>Cancel</DialogClose>
      </DialogContent>
    </Dialog>
  )
}
vue
<script setup lang="ts">
import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogTitle,
  DialogTrigger,
} from '@zeus-web/dialog/vue'
</script>

<template>
  <Dialog>
    <DialogTrigger>Open dialog</DialogTrigger>
    <DialogContent>
      <DialogTitle>Publish project?</DialogTitle>
      <DialogDescription>
        The project will become visible to everyone.
      </DialogDescription>
      <DialogClose>Cancel</DialogClose>
    </DialogContent>
  </Dialog>
</template>

Add ​

bash
zweb add dialog

Imports ​

Styled registry component:

tsx
import {
  Dialog,
  DialogTrigger,
  DialogContent,
  DialogTitle,
  DialogDescription,
  DialogClose,
} from '@/components/ui/dialog'

Primitive React wrapper:

tsx
import {
  Dialog,
  DialogTrigger,
  DialogContent,
  DialogTitle,
  DialogDescription,
  DialogClose,
} from '@zeus-web/dialog/react'

Web Component entry:

ts
import '@zeus-web/dialog/wc/auto'

Props ​

PropTypeDefaultDescription
openboolean-Controlled open state.
defaultOpenboolean-Initial open state.
modalbooleantrueWhether the dialog is modal.

Events ​

EventReact propDetailDescription
open-changeonOpenChangeopen: boolean, nativeEvent?: EventEmitted when open state changes.

Slots ​

SlotDescription
defaultDialog child components.

Styling ​

Uses Tailwind: yes

Theme tokens:

  • bg-background
  • text-foreground
  • ring-ring

Internal selectors:

  • [data-slot=dialog-content]
  • [data-slot=dialog-title]
  • [data-slot=dialog-description]

Registry ​

Registry source: available.

Add command: zweb add dialog

Type: component

Dependencies:

  • @zeus-web/dialog

Registry dependencies:

  • cn
  • globals

Files:

  • templates/react/dialog.tsx → components/ui/dialog.tsx
  • templates/vue/dialog.ts → components/ui/dialog.ts

AI usage rules ​

Do:

  • Use Dialog, DialogTrigger and DialogContent together.
  • Use DialogTitle for accessible titles.
  • Use DialogDescription when extra accessible context is available.
  • Rely on the primitive for Escape close, focus return, and modal focus trapping.

Do not:

  • Do not create a second overlay unless the registry provides one.
  • Do not remove DialogTitle when the dialog needs an accessible name.
  • Do not manually wire aria-labelledby or aria-describedby when using the provided title and description primitives.

Examples ​

React styled usage ​

tsx
import {
  Dialog,
  DialogContent,
  DialogTitle,
  DialogTrigger,
} from '@/components/ui/dialog'
import { Button } from '@/components/ui/button'

export function Example() {
  return (
    <Dialog>
      <DialogTrigger>
        <Button>Open</Button>
      </DialogTrigger>
      <DialogContent>
        <DialogTitle>Title</DialogTitle>
      </DialogContent>
    </Dialog>
  )
}

Released under the MIT License.