vUXDocs v4.1.0

Prompt

A runnable demo of vUX-prompt.js. See the Prompt guide for the full API.

Live example

Runs the module from this site, with every control on the page. Open it in its own tab for the full layout.

Open the live example

The page

SectionShows
Heroalert(), confirm() (with danger) and input() one click each, and what each resolved with
Playgroundlive control of every config property, per-call title, danger and required, the equivalent code, and a log of each answer, so Cancel, Escape and a backdrop click can be compared
Real flowsa guarded delete (focus starts on Cancel), a rename checked by an async validate() against a fake server, and two instances asking at once through the shared queue
Bad inputsix ways the config and the methods reject a value, printing the thrown error

What it demonstrates

  • Answers, not callbacks. Every handler is async and reads the answer with await, the way the native calls were used.
  • Async validation. In the rename card, OK is disabled while the 600ms check runs; "taken" is refused with the server's message and the dialog stays open.
  • One dialog at a time. "Ask twice" fires a light and a dark question in the same tick; the second opens only after the first closes.
  • Text, never markup. Messages are passed as plain strings, including ones built from page data; the library never parses them as HTML.