Docs Menu
Docs/Guides/Validation & Async Locks
Updated October 2026

Validation & Async Locks

Synchronous and asynchronous input validation, live error messages, and preConfirm submission locks.

Prevent invalid submissions and display live inline error messages without closing the dialog.

typescript

const res = await ui.prompt({ title: 'Choose Organization Handle', input: 'text', placeholder: 'acme-inc', validate: async (val) => { if (!val || typeof val !== 'string' || val.length < 3) { return 'Handle must be at least 3 characters.'; } const isTaken = await checkHandleAvailability(val); if (isTaken) { return 'This handle is already registered by another organization.'; } return undefined; // valid }, preConfirm: async (val) => { // Buttons enter loading spinner state while this promise runs return await api.createOrg(val as string); }, }); `

Want to test these options live?

Launch the interactive playground to experiment with themes, positions, and live generators.

Open in Playground →