pub fn tabs<F>(args: TabsArgs, state: TabsState, scope_config: F)Expand description
§tabs
Renders a set of tabs with corresponding content pages.
§Usage
Display a row of tab titles and a content area that switches between different views.
§Parameters
args— configures the tabs’ layout and indicator color; seeTabsArgs.state— a clonableTabsStateto manage the active tab and animation.scope_config— a closure that receives aTabsScopefor defining each tab’s title and content.
§Examples
use tessera_ui_basic_components::{
tabs::{tabs, TabsArgsBuilder, TabsState},
text::{text, TextArgsBuilder},
};
// In a real app, you would manage this state.
let tabs_state = TabsState::new(0);
tabs(
TabsArgsBuilder::default().build().unwrap(),
tabs_state,
|scope| {
scope.child(
|| text(TextArgsBuilder::default().text("Tab 1".to_string()).build().unwrap()),
|| text(TextArgsBuilder::default().text("Content for Tab 1").build().unwrap())
);
scope.child(
|| text(TextArgsBuilder::default().text("Tab 2".to_string()).build().unwrap()),
|| text(TextArgsBuilder::default().text("Content for Tab 2").build().unwrap())
);
},
);