Velocity X Components

Standard Overlays & Menus

Modal Dialog

Accessible native modal dialog with inert background, Escape close, backdrop dismissal, and focus restoration.

Subscription Included with the Velocity Components subscription.
bash
$ velocityx add standard-modal-dialog

Built for react. Needs react already installed as a peer dependency. An Astro-only project needs @astrojs/react wired up first — this won't run on its own in plain Astro.

Full docs for Modal Dialog →

Needs a licence key — subscribe here, then velocityx loginonce.

react v1.0.1 react
Modal Dialog

Project details

A native modal keeps focus in this panel until it closes. Press Escape or use either close control.

This content can contain links, buttons, or any React children. The page behind remains inert while the dialog is open.

Props

NameTypeRequiredDefaultDescription
triggerLabelstringNo'Open dialog'
titlestringNo'Dialog'
descriptionundocumentedYes
childrenundocumentedYes
closeLabelstringNo'Close'
openundocumentedYes
defaultOpenbooleanNofalse
onOpenChangeundocumentedYes

5 fields in this table have an undocumented type — see source for the exact shape.

File this creates

The CLI writes this path into your project, relative to its root — nothing else moves.

text
components/velocity/standard-modal-dialog/ModalDialog.jsx

Using the Modal Dialog component

Install it with velocityx add standard-modal-dialog. The CLI writes the source straight into your project — no runtime dependency, no registry lock-in, and it themes itself from the same primary-*/accent-* scale as the rest of the library.

More from Standard Overlays & Menus.