Dialog
Modal dialog for confirmations, forms, and destructive alerts, with a focus trap, escape handling, and an overlay scrim.
import {
Dialog,
DialogBody,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogHeaderAction,
DialogTitle,
DialogTrigger,
} from "@plexui/vue/components/Dialog";At 767px and below, mobile-variant="alert" presents a compact centered glass alert, a confirmation or a request for one short value, with inline actions and no close icon. Use mobile-variant="sheet" for forms and details: it opens at the bottom with a grabber, a leading Close button and a centered title. Both variants preserve the desktop appearance.
Alert actions wrap onto separate rows when their labels need more space. Set <DialogFooter mobile-layout="stacked"> when the actions should always stack. Put long sheet content in DialogBody to keep the header and actions visible while the body scrolls.
Examples
Overview
Destructive confirmation
Text field
Metadata details
Scrolling body
Placement
Phone offers a bottom Sheet or a fullscreen form. Desktop also includes center, top, start and end placements.
View options sheet
A compact sheet for preferences that take effect immediately. On phones it is a bottom sheet on the grouped surface, flush with the sides and bottom of the screen: a web page cannot know the device's corner radius, so the sheet does not float. Done and outside dismissal keep the selection; opening it again shows the current values. Desktop uses a centered dialog.
Copy the ViewOptionsSheet helper, option data, and shared styles together, preserving their relative paths. The helper composes Dialog, FieldGroup, Field, Select and Switch. Its controlled v-model:value connects the choices to your application.
Files
Current view
Segmented composer header
A Close action, an Event/Reminder segmented control, and a Save action share the sheet header. Switching the segment changes the fields while preserving each draft. The fields follow the native composer: the title and the notes are named by their placeholders, each in its own group; an event shows its day and hours in one row, and a tap opens it into Starts and Ends, each a date and a time, All-day, which leaves the dates, and Repeat. Moving the start keeps the event's length; an end before the start is struck through and Save waits for a later one. A reminder lists Date, Time and Urgent with an icon each, a set value under its title in the accent, and a switch for the time. The whole Date row opens the calendar, whose time fields set the hour while Time is on. Save commits the selected local sample; Close, Escape, or outside dismissal discards unsaved edits. These sample values do not create calendar items. In Phone previews the sheet stays open after Save or Cancel so its state remains inspectable.
Copy the SegmentedComposer helper, draft data, and shared styles together, preserving their relative paths. The helper uses Dialog, SegmentedControl, FieldGroup, Field, Input, Textarea, DatePicker, Select, Switch and Icon.
Setup choices
Rows that each open the next step: a leading icon, a title, an optional subtitle and a disclosure chevron, and the whole row is one button. On phones the sheet is on the plain surface, with the rows in one group or each in its own rounded cell. A row replaces the choices with its step in the same sheet; Back returns to the row that opened it and Close dismisses the sheet. Desktop uses a centered dialog with Back in its footer. Add confirms the local sample; nothing is sent.
Copy the SetupChoicesSheet helper, method data, and shared styles together, preserving their relative paths. The helper uses Dialog, Toolbar, NavigationButton, FieldGroup and Button, with line icons from lucide-static and @hugeicons/core-free-icons (the hero) whose weight the sheet sets: a native setup sheet draws its large glyphs with a light line. layout and subtitles choose the presentation; the add event receives the confirmed method.
Steps
Keep it open
API
Dialog (root)
| Prop | Type | Default | Description |
|---|---|---|---|
open / v-model:open | boolean | — | Controlled open state; uncontrolled when omitted |
@update:open | (open: boolean) => void | — | Fires when the dialog opens or closes |
DialogContent
| Prop | Type | Default | Description |
|---|---|---|---|
surface | "plain" | "grouped" | "plain" | Mobile panel and field-group palette. Dark dialogs use elevated surface levels; desktop colors stay unchanged |
width | number | string | 480 | Panel width. Mobile alert uses its compact width; a bottom sheet fills the viewport width |
show-close | boolean | true | Show the built-in close button. Mobile sheet places it at the leading edge; mobile alert hides it |
class | string | — | Additional CSS class on the panel |
placement | "center" | "top" | "bottom" | "start" | "end" | "fullscreen" | "center" | Where the panel sits: centered, near the top, a bottom sheet, a side panel, or the whole screen |
mobile-variant | "alert" | "sheet" | — | Mobile appearance at 767px and below. Alert is compact and centered; sheet defaults to the bottom. Omit for the standard appearance |
mobile-placement | "center" | "bottom" | "fullscreen" | — | Placement at 767px and below. Defaults to bottom for sheet, otherwise placement. Alert stays centered |
@open-auto-focus | (event: Event) => void | — | Called when focus moves into the dialog on open; call event.preventDefault() to place it yourself, for example on the panel instead of the first field |
@close-auto-focus | (event: Event) => void | — | Called when focus returns on close; call event.preventDefault() to keep it elsewhere |
@escape-key-down | (event: KeyboardEvent) => void | — | Called on Escape before the dialog closes; call event.preventDefault() to keep it open |
@interact-outside | (event: DialogInteractOutsideEvent) => void | — | Called on a press or a focus outside the dialog before it closes; call event.preventDefault() to keep it open. event.detail.originalEvent is the browser's event |
z-index | number | 50 | Stack order of the overlay and the dialog, for a page whose own layers sit above 50 |
root-props | DialogLayerProps | — | class, style and data attributes for the fixed layer that holds the panel. Data attributes on DialogContent land there too |
overlay-props | DialogLayerProps | — | class, style and data attributes for the overlay |
layout | "auto" | "phone" | "auto" | phone lays the dialog out as on a phone at any window width, with the dialogs it opens. Inside a PhoneLayout it always is |
Over a phone keyboard the dialog covers the part of the window the keyboard leaves visible, so a sheet sits on the keyboard and a centered panel stays in view. Inside a PhoneLayout it portals into the PhoneLayout box and covers it instead of the window.
DialogTrigger: opens the dialog; renders its child element (Reka's as-child).
DialogHeader: wrapper for title, description and an optional header action. In a phone Sheet the header is the Sheet's Toolbar: Close at the leading edge, the title alone, centered on the 44px row of controls, and the header action at the trailing edge, as in the iOS 27 kit. The description stands under the bar as the first text of the content, at the top of the body when there is one, in the label color of the sheet's text. If the Dialog has its own top Toolbar, that one replaces the header's bar. In a phone Sheet, background sets how the bar meets the body scrolled under it: glass (the default), soft, hard or solid, as on a Toolbar.
DialogHeaderAction: positions one toolbar control beside Close on desktop and opposite Close in a mobile sheet. Place it directly inside DialogHeader (a fragment there is fine, a component of your own that returns it is not: a phone Sheet looks for it among the header's own parts to stand it at the trailing edge) and label icon-only controls. Mobile alerts hide this slot.
DialogTitle: accessible heading for the dialog.
DialogDescription: supporting text under the title.
DialogBody: the scrolling part between the header and the footer. With it, only the body scrolls. Accepts class.
DialogDescriptionSlot: where a phone Sheet's description goes in content of your own that takes the place of DialogBody, such as a scroller inside a form so that Enter submits. Put it first in that content: the description starts it, as it starts DialogBody, and it comes before the body's place. Without either, the description stands under the bar in the flow of the Sheet, so keep the bar in flow there. It renders nothing outside a phone Sheet.
DialogFooter: footer area for action buttons. Mobile alert actions are 48px pills in a wrapping row by default. Mobile sheets use 50px pill actions, 24px side gutters and at least 24px below the actions, including the bottom safe area. Standard dialogs and sheets stack their mobile actions.
| Prop | Type | Default | Description |
|---|---|---|---|
background | "soft" | "hard" | "glass" | "solid" | "soft" | How the phone Sheet's bar meets the body scrolled under it, as on a Toolbar. Also available on the header; desktop and Alert surfaces are unchanged |
mobile-layout | "inline" | "stacked" | — | Action layout at 767px and below. Defaults to inline for alert, stacked otherwise. Inline actions wrap when they do not fit |
DialogClose: closes the dialog when its child is activated.
DialogSteps: the steps of a flow, such as a sign-in that asks for an email and then a code. Place it in DialogBody.
| Prop | Type | Default | Description |
|---|---|---|---|
step | string | number | — | The step on screen. A new value brings its content in |
direction | "forward" | "back" | "forward" | forward brings the new step in from the trailing edge over the one before; back returns to a step before it |
class | string | — | Additional CSS class on the steps |
Styling
Use surface="grouped" on dialog content for grouped forms. The default surface="plain" suits confirmations and standalone content. Mobile dialogs use elevated dark surface levels; the choice is independent of alert/sheet geometry and the bars' background.
Dialog reads the shared semantic color, typography and spacing tokens listed in Design tokens, so it follows theme changes made there. Override these Dialog tokens at any scope:
--dialog-panel-background: panel color, and the color of a Sheet's soft, hard and solid bars; mobile follows the selected elevated surface role--dialog-close-background: close button background (defaulttransparent)--dialog-close-background-hover: close button background on hover--dialog-z-index: stack order of the overlay and the dialog (default50;z-indexsets it)--dialog-viewport-height: the height the panel fits in (default100dvh; the dialog sets it over a phone keyboard and inside a PhoneLayout)--dialog-steps-background: background of a step, which covers the one under it as it comes in (default the panel color)
Standard mobile appearance uses these tokens:
--dialog-mobile-close-size: visible close-button circle (default--control-size-md, 32px)--dialog-mobile-close-icon-size: close SVG box (default--control-icon-size-2xl, 24px; the glyph occupies about 12px)--dialog-mobile-close-background: mobile close button fill (default secondary soft)--dialog-mobile-radius: mobile panel corner radius (default--radius-4xl, 24px)--dialog-mobile-action-size: mobile footer height and close-button touch target (default--control-size-2xl, 44px)--dialog-mobile-action-radius: mobile footer button radius (default--radius-full)--dialog-mobile-action-font-size: mobile footer button text size (default--control-font-size-lg)
Alert and Sheet use these additional tokens:
--dialog-alert-width: compact alert width (default300px,320pxfrom a 414px wide phone withtouch.css, as a native alert at 430pt; capped by the viewport)--dialog-alert-radius: alert corner radius (default34px)--dialog-alert-padding: alert outer padding, the inset of a field and the actions (default14px)--dialog-alert-action-height: minimum Alert action height (default48px)--dialog-alert-field-height: height of a field in the alert on a phone (default52px)--dialog-alert-background,--dialog-alert-backdrop-filter: alert material on a phone (withtouch.cssthe mobile glass,--mobile-glass-background, overblur(10px))--dialog-alert-message-color,--dialog-alert-message-size,--dialog-alert-message-leading: alert message on a phone (defaultvar(--color-text),17px,22px)--dialog-alert-fill: fill of a soft Cancel and a soft field in the alert (withtouch.css--alpha-12)--dialog-alert-action-gap,--dialog-alert-action-font-weight: gap between two inline actions and their weight (default8px,600)--dialog-sheet-action-height: minimum Sheet action height (default50px)--dialog-sheet-radius: sheet top corner radius (default38px; fullscreen stays square)--dialog-mobile-scrim: dim behind a phone Sheet or Alert (default black at 20% in light and 50% in dark, as native iOS 26); desktop keepsrgb(0 0 0 / 0.5)--dialog-sheet-close-size: sheet close-button circle and touch target (default--control-size-2xl, 44px)--dialog-sheet-close-icon-size: sheet close SVG box (default34px; the visible cross is about 17px)--dialog-mobile-type-size: Alert and Sheet heading, description and actions (default17px)--dialog-mobile-type-leading: Alert and Sheet heading, description and action line height (default22px)