Fusuma

Components / Composite

fab

A round button with an icon, in the main action's colour: the one thing a screen is for (compose, add).

Try it

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

Live: Bars, where fab is usedOpen full size

Also on this pagetop_bartoolbaricon_badgesearch_barmarksnavigation_bartoggle_groupchip_groupbutton_groupavatar_group

A round button with an icon, in the main action's colour: the one thing a screen is for (compose, add). With a label it is an extended one.

Signature

pub fn fab<M>(icon: Icon, label: &str) -> Button<'_, M>

Methods

  • .primary() -> Self — The main action's look.
  • .ghost() -> Self — A quiet look: no fill and no outline until the pointer is over it.
  • .danger() -> Self — For what cannot be taken back: filled with the danger colour.
  • .tonal() -> Self — A softer main action: the brand colour thinned out, with the brand colour for the label.
  • .on_press(message: M) -> Self — Sends message when pressed.
  • .enabled(enabled: bool) -> Self — Whether it can be used (it is by default).
  • .icon_filled(filled: bool) -> Self — Fills in the icon (its closed shapes as well as its outline): a chosen state, a liked heart.
  • .icon(icon: fusuma_icons::Icon) -> Self — An icon before the text.

Example

use fusuma::{Icon, fab};
let view = fab(Icon::Plus, "New").on_press(());
let built = fusuma::doc::built::<(), _>(&view);
assert_eq!(built.texts(), ["New"]);

All components · Source