Separator
A thin rule between pieces of content: horizontal or vertical, solid or dashed, with an optional label.
Horizontal
ui.add(Separator::horizontal());
ui.add(Separator::horizontal().label("With Label"));
ui.add(Separator::horizontal().dashed());
ui.add(Separator::horizontal().dashed().label("Dashed With Label"));
Vertical
ui.add(Separator::vertical().length(100.0));
ui.add(Separator::vertical().length(100.0).label("Solid"));
ui.add(Separator::vertical().length(100.0).dashed());
ui.add(Separator::vertical().length(100.0).dashed().label("Dashed"));
In context
let muted = tokens(ui.ctx()).muted_foreground;
ui.vertical(|ui| {
ui.spacing_mut().item_spacing.y = 8.0;
ui.label("Hello fastframe");
ui.label(
egui::RichText::new("Themed egui components for native apps.").color(muted),
);
});
ui.add(Separator::horizontal());
ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = 16.0;
ui.label("Docs");
ui.add(Separator::vertical().dashed().length(16.0));
ui.label("GitHub");
ui.add(Separator::vertical().dashed().length(16.0));
ui.label("Source");
});
Your label
ui.text_edit_singleline(&mut state.label);
ui.add(Separator::horizontal().label(state.label.as_str()));
The story above is gallery/src/stories/separator.rs, running in your browser. Every snippet on this page is cut from it.