pub struct Tabs { /* private fields */ }Expand description
Tabs component for switching between content sections
§Example
use armas_basic::Tabs;
let mut tabs = Tabs::new(vec!["Account", "Password"])
.height(24.0)
.font_size(12.0);
let response = tabs.show(ui);
if response.changed {
// Tab changed to response.selected
}Implementations§
Source§impl Tabs
impl Tabs
Sourcepub const fn list_radius(self, radius: f32) -> Self
pub const fn list_radius(self, radius: f32) -> Self
Set outer container corner radius
Sourcepub const fn trigger_radius(self, radius: f32) -> Self
pub const fn trigger_radius(self, radius: f32) -> Self
Set active indicator corner radius
Sourcepub const fn trigger_padding_x(self, padding: f32) -> Self
pub const fn trigger_padding_x(self, padding: f32) -> Self
Set horizontal padding inside each tab trigger
Sourcepub fn show(&mut self, ui: &mut Ui) -> TabsResponse
pub fn show(&mut self, ui: &mut Ui) -> TabsResponse
Show the tabs and return the response
Sourcepub fn show_ui(
&mut self,
ui: &mut Ui,
count: usize,
render_tab: impl Fn(usize, &mut Ui, &ContentContext),
) -> TabsResponse
pub fn show_ui( &mut self, ui: &mut Ui, count: usize, render_tab: impl Fn(usize, &mut Ui, &ContentContext), ) -> TabsResponse
Show the tabs with custom content for each tab trigger.
The closure receives the tab index, a &mut Ui, and a ContentContext.
If width is not set, the tabs use ui.available_width()
and distribute tab widths evenly.
§Example
ⓘ
let mut tabs = Tabs::new(Vec::<String>::new()).height(28.0);
let response = tabs.show_ui(ui, 3, |index, ui, ctx| {
// Render icon + label for tab `index` using ctx.color
let labels = ["Account", "Password", "Settings"];
ui.label(labels[index]);
});Auto Trait Implementations§
impl Freeze for Tabs
impl RefUnwindSafe for Tabs
impl Send for Tabs
impl Sync for Tabs
impl Unpin for Tabs
impl UnsafeUnpin for Tabs
impl UnwindSafe for Tabs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more