Skip to content

Resizable

Two panes side by side with a draggable divider.

ui.resizable

Basic

ui.column().h(96).bordered().rounded_md().children(|ui| {
ui.resizable(&mut self.sidebar)
.min(80)
.max(280)
.first(|ui| {
ui.column().p(10).children(|ui| {
ui.text("Folders");
});
})
.second(|ui| {
ui.column().p(10).children(|ui| {
ui.text("The second pane takes the remaining width.");
});
});
});

Vertical

ui.column().w_fill().h(120).bordered().rounded_md().children(|ui| {
ui.resizable(&mut self.split)
.vertical()
.min(32)
.first(|ui| {
ui.column().p(10).children(|ui| {
ui.text("Editor");
});
})
.second(|ui| {
ui.column().p(10).children(|ui| {
ui.text("Output");
});
});
});

API reference

SettingDescription
.vertical()Stacks the panes, first on top. size is then the first pane's height.
.min(size: impl Length)The smallest size of the first pane. The second pane keeps at least the same size.
.max(size: impl Length)The largest size of the first pane.
.first(f: impl FnOnce(&mut Ui<'a>))Declares the first pane, a clipping column, followed by the divider.