Skip to main content

tab

Function tab 

Source
pub fn tab(row: TabRow) -> TabBuilder
Expand description

§tab

Renders a single tab inside tabs.

§Usage

Use inside a tabs().content(...) slot to declare one tab-strip item.

§Parameters

  • row — row configuration received by the enclosing tabs content slot.
  • selected — optional controlled selection; otherwise follows the tab row.
  • on_click — callback invoked when the tab is activated.
  • enabled — whether this tab can be focused or activated.
  • title — custom title slot; primary indicators match its intrinsic width. The slot owns its content padding.
  • label — built-in Material text label for the tab.
  • icon — built-in Material icon for the tab.
  • accessibility_label — accessible name override. Authors must provide a nonempty name for icon-only tabs and non-text custom titles.

§Examples

use tessera_components::tabs::{tab, tabs};
use tessera_components::text::text;
use tessera_ui::{remember, tessera};

#[tessera]
fn demo() {
    let selected = remember(|| 0usize);
    tabs().selected(selected).content(move |row| {
        tab(row)
            .label("Home")
            .selected(selected.get() == 0)
            .on_click(move || selected.set(0));
    });
}