Loading...
Skip to main content

DialogBox model

The DialogBox model composes the Dialog wrapper with promise-based dialogs. open() returns a promise that resolves or rejects when the dialog closes.

Promise-based dialogs

Create the model with a render function, then await open() to collect the result. The example below resolves with the submitted numbers and rejects when the dialog is dismissed.

Dialog

document/component/Document/DialogModelDemo.tsx
const inputDialog = new DialogBox(({ defer }) => (
<Dialog open={!!defer} onClose={() => defer?.reject(new DialogBoxClose())}>
<Form onSubmit={submit}>
<FormControl name="a" type="number" />
</Form>
</Dialog>
));

const data = await inputDialog.open();
Documentation navigation
On this page
On this page