Sheet
A sheet: a modal panel beside an edge of the window, the right one by default, shown while the dialog key is open. It is for more than a dialog holds, such as settings or details.
ui.sheetBasic
if ui.button("Open sheet").outline().clicked() { ui.open_dialog("profile");}let sheet = ui.sheet("profile").title("Edit profile");let sheet = sheet.description("Changes are saved when you press Save.");sheet.children(|ui| { ui.field("Name").children(|ui| { ui.text_input(&mut self.full_name).placeholder("Jane Doe"); }); ui.field("Username").children(|ui| { ui.text_input(&mut self.username); }); // The buttons go to the bottom of the sheet. ui.spacer(); ui.row().w_fill().gap(8).justify_end().children(|ui| { let cancel = ui.button("Cancel").outline().clicked(); let save = ui.button("Save").primary().clicked(); if cancel || save { ui.close_dialog("profile"); } });});Side
ui.row().gap(8).children(|ui| { for (name, side) in [ ("Left", Side::Left), ("Right", Side::Right), ("Top", Side::Top), ("Bottom", Side::Bottom), ] { if ui.button(name).outline().clicked() { ui.open_dialog(("sheet", name)); } let sheet = ui.sheet(("sheet", name)).title(name).side(side).size(240); sheet.children(|ui| { ui.text("Press Esc or click outside to close.").muted(); }); }});API reference
| Setting | Description |
|---|---|
.title(title: impl Display) | The title, which also names the sheet for assistive technology. |
.description(text: impl Display) | The text below the title. |
.side(side: Side) | The edge of the window the sheet is on and slides in from, the right one by default. |
.size(size: impl crate::style::Length) | How far the sheet reaches into the window: its width on the left or right, by default 384, and its height at the top or bottom, by default 320. Part of the window always stays uncovered. |
.children(f: impl FnOnce(&mut Ui<'a>) | Declares the content with f while open. |