Form
A form whose field labels form a right-aligned column, as wide as the widest, beside the controls.
ui.formBasic
ui.form().children(|ui| { ui.field("Name").children(|ui| { ui.text_input(&mut self.name).placeholder("Jane Doe"); }); ui.field("Seats").children(|ui| { ui.number_input(&mut self.seats, 1..=99).w(120); });});Different controls
let roles = [(0, "Viewer"), (1, "Editor"), (2, "Owner")];ui.form().children(|ui| { ui.field("Owner").required().children(|ui| { ui.text_input(&mut self.owner); }); ui.field("Role").children(|ui| { ui.select(&mut self.role, &roles); }); ui.field("Backups").description("Once a day.").children(|ui| { ui.switch(&mut self.backups, "Enabled"); });});API reference
| Setting | Description |
|---|---|
.children(f: impl FnOnce(&mut Ui<'a>) | Places the form with the fields declared by f, and returns the result of f. |