@jsvision/ui / inputBox
Function: inputBox()
inputBox(
host,o):Promise<string|null>
Defined in: ui/src/dialog/message-box.ts:156
Prompt for a single line of text modally. An optional validator gates OK through the dialog's valid() sweep, which keeps the box open and refocuses the field when the value is invalid.
Parameters
host
The modal host (an Application, or { loop, desktop }).
o
Title, field label (with optional ~X~ hotkey), the two-way value signal, and validator.
Returns
Promise<string | null>
The entered string on OK, or null if the user cancels.
Example
ts
import { signal } from '@jsvision/ui';
const name = signal('');
const entered = await inputBox(app, { title: 'Rename', label: '~N~ew name', value: name });
if (entered !== null) rename(entered);