Module modal_prompt
Expand description
Shared content body for a text-entry ModalDialog.
PromptBody drops into ModalDialog as the content C; the dialog
owns the backdrop/box/title/footer/Esc while the body renders an
optional caption, an optional field label, and a TextInput with
selection, clipboard, and accessibility support. The host reads the result
with PromptBody::value on submit.
ⓘ
let body = PromptBody::new("Name", "New volume")
.with_caption("Choose a name for the volume.");
let dialog = ModalDialog::new("Create volume", body)
.open(true)
.with_max_width(420.0)
.primary_action("Create", move || submit.set(true))
.secondary_action("Cancel", move || cancel.set(true));
// …on submit: dialog.content().value()A confirmation that waits for a typed phrase (erasing a disk, deleting a
vault) is PromptBody::confirm_phrase with the dialog’s primary action
gated on PromptBody::confirms:
ⓘ
ModalDialog::new("Erase sdb?", PromptBody::confirm_phrase(message, "sdb"))
.with_destructive(true)
.primary_action("Erase", erase)
.primary_enabled_if(PromptBody::confirms)
.secondary_action("Cancel", cancel);Structs§
- Prompt
Body - Renders
caption → label → field, where caption and label are optional.