Fusuma

Components / Basics

tab

A tab of a tab bar.

Try it

This is the Climate page of the gallery, running in your browser: tab is on it, and it is the real widget. Press Run, then use it.

Live: Climate, where tab is usedOpen full size

Also on this pagetagitemtab_bar

A tab of a tab bar.

Put tabs in a tab_bar; the chosen one has the bar under it.

Signature

pub const fn tab<M>(text: &str, selected: bool) -> Tab<'_, M>

Methods

  • .on_select(message: M) -> Self — Sends message when it is chosen.
  • .icon(icon: fusuma_icons::Icon) -> Self — An icon before the text.

Example

use fusuma::{tab, tab_bar};
let view = tab_bar((tab("Day", true).on_select(0), tab("Week", false).on_select(1)));
let built = fusuma::doc::built::<i32, _>(&view);
assert_eq!(built.texts(), ["Day", "Week"]);

All components · Source