Dialog

Alignment target:@astryxdesign/core v0.7.1 · Dialog

Modal Title
Dialog content goes here.

Usage #

Dialog presents one modal task above the page. It uses the native <dialog> element, so it traps focus, locks the page behind a backdrop, and returns focus to the element that opened it. Pair it with DialogHeader to get a focusable title, an optional subtitle, and a close button.

Vue
<script setup lang="ts">
import { Button } from '@astryx-vue/core/Button'
import { Dialog, DialogHeader } from '@astryx-vue/core/Dialog'
import { ref } from 'vue'

const isOpen = ref(false)
</script>

<template>
  <Button label="Share project" variant="secondary" @click="isOpen = true" />
  <Dialog :is-open="isOpen" @open-change="isOpen = $event">
    <DialogHeader title="Share project" has-close-button @open-change="isOpen = $event" />
    <p>Copy the link and send it to your team.</p>
  </Dialog>
</template>

Anatomy

ElementDescription
HeaderTitle, optional subtitle, and close button. The title receives focus on open and labels the dialog via aria-labelledby.
BodyThe main content area: text, forms, lists, or any layout.
FooterAction buttons like Save/Cancel or Accept/Decline, aligned to the end.
BackdropSemi-transparent overlay behind the dialog that blocks page interaction.

Best practices #

GuidancePractices
DoChoose the right purpose: info for dismissable content, form to prevent accidental backdrop dismissal, required when the user must respond.
DoInclude a clear title in the header so users immediately understand what the dialog is asking.
DoUse purpose="form" for dialogs with inputs so the user can't accidentally lose data by clicking the backdrop.
DoKeep dialogs focused on a single task; if the content grows beyond what fits, consider a full page instead.
Don'tUse a dialog for simple messages that could be shown inline or as a toast notification.
Don'tNest dialogs inside other dialogs; restructure the flow into steps within a single dialog instead.
Don'tUse the fullscreen variant for simple confirmations; it is meant for complex content like editors or long forms.

Examples #

Dialog — Adaptive presentation

Edit profile
Dialog remains the default presentation. This example explicitly opts into a Bottom Sheet only at lg and below when the device has a coarse pointer and no hover. Pass the presentation prop to make tests or unusual environments deterministic. In Bottom Sheet presentation, purpose="form" blocks scrim clicks and swipe dismissal while preserving Escape. Use this opt-in only when that contract is acceptable; keep AlertDialog/destructive confirmations on Dialog unless a product deliberately chooses otherwise.
Open in Playground

Dialog stays the default. On a coarse pointer at lg and below, the same profile form opens as a bottom sheet.

Dialog — Confirmation

Delete project?
This will permanently delete "Marketing Dashboard" and all of its data. This action cannot be undone.

Asks before a destructive action. The inline preview stays on the page; its buttons open the real dialog.

Dialog — Form

Edit profile
Update your display name and bio

Collects a name and bio without leaving the page. purpose form keeps Escape and ignores backdrop clicks.

Dialog — Fullscreen

Help & Documentation 5 articles · Last updated Apr 2026
Documentation
Everything you need to get started
Getting startedCreate your first project by clicking New Project in the sidebar. Choose a template or start from scratch.
Team membersInvite collaborators from Settings > Team. Each member can have Admin, Editor, or Viewer permissions.
BillingFree plans include up to 3 projects. Upgrade to Pro for unlimited projects and priority support.
API accessGenerate API keys from Settings > Developer. Rate limits are 1,000 requests per minute on free plans.
Data exportExport your data anytime from Settings > Data. Exports are available as CSV or JSON within 24 hours.
Open in Playground

variant fullscreen fills the viewport for documentation and other long reading.

Dialog — Scrollable

Terms and Conditions
1. You agree to use the service only for lawful purposes and in compliance with all applicable laws and regulations in your jurisdiction.2. Your account credentials are your responsibility. Notify us immediately if you suspect unauthorized access to your account.3. We reserve the right to suspend accounts that violate these terms or engage in abusive behavior toward other users.4. Content you upload remains your property. You grant us a license to host and display it within the service.5. We may update these terms at any time. Continued use after changes constitutes acceptance of the updated terms.6. The service is provided as-is without warranties of any kind. We are not liable for data loss or service interruptions.7. You may cancel your account at any time. Your data will be deleted within 30 days of cancellation.8. Disputes will be resolved through binding arbitration in accordance with applicable regulations.9. You agree not to reverse-engineer, decompile, or disassemble any part of the service or its underlying technology.10. We may collect anonymized usage data to improve the service. Personal data is handled per our Privacy Policy.11. Third-party integrations are governed by their own terms. We are not responsible for third-party service outages.12. You are responsible for maintaining backups of your data. We provide export tools but do not guarantee data recovery.13. Commercial use requires a Business plan. Free accounts are limited to personal and non-commercial projects.14. We may introduce new features or discontinue existing ones with 30 days notice via email or in-app notification.15. Violation of these terms may result in immediate termination of your account without prior notice or refund.

maxHeight keeps the dialog short and scrolls the terms inside it.

Dialog — Required

Transfer project ownership
This action requires confirmation from the new owner
You are about to transfer "Marketing Dashboard" to Sarah Chen. Once accepted, you will lose admin access.

purpose required blocks Escape and the backdrop. The user has to choose Cancel or Transfer.

Accessibility #

Dialog is built on the native <dialog> element, so the modal behavior, the focus trap, and the focus handoff on close all come from the browser rather than from extra configuration.

The dialog is shown with showModal(), which makes the rest of the page inert while it is open. When it opens, initial focus goes to the first element with data-autofocus; if no element has that attribute, focus goes to the DialogHeader title.

The dialog takes its name from the DialogHeader title, which the component associates with the dialog through aria-labelledby. An explicit aria-label or aria-labelledby replaces that name with the one you provide.

Escape and backdrop clicks do not close the dialog directly. They emit openChange(false), and the parent decides whether to close. When the dialog closes, focus returns to the element that was focused when it opened, as long as that element is still in the page.

Limitations #

Two constraints shape what you can put inside a dialog, and both are worth knowing before you combine it with other components.

  • Tooltip and Popover render into body. Inside an open Dialog they sit beneath the modal top layer, so they cannot be seen or used. Do not nest them inside a dialog until they are moved into the dialog's own layer.
  • Dialogs cannot be nested. If a flow needs several steps, restructure it as steps within a single dialog rather than opening a second one.

Layout #

The standard variant sizes itself with width and maxHeight, and clamps to the viewport with spacing gutters on narrow screens. position places it at a static offset. Logical start and end offsets mirror under RTL.