Reference

Fab

A round button floating at the bottom of the screen for the page's main action; with Fab.Actions in its block it opens them instead (a speed dial).

Fab(icon: String, label: String) { … }

Since 6.2.0

No preview for this one: the example below shows how it is written.

Example

wf

state said = "Nothing made yet" Fab(icon: "plus", label: "Create") { Fab.Action("Note", icon: "file") { on click { said = "A new note" } } Fab.Action("Folder", icon: "folder") { on click { said = "A new folder" } } Fab.Action("Upload", icon: "upload") { on click { said = "An upload" } } } Text(said).muted

One action

wf

state notes = 0 Fab(icon: "plus", label: "New note") { on click { notes = notes + 1 } } Text("{notes} notes")

Props

Props of Fab
PropTypeUnsetMeaning

icon:

String (required)

—

The icon on the round button, one of the built-in icon names; required with label:, or the call draws as a plain element

label:

String (required)

—

What the button does: its accessible name and tooltip (aria-label, title); never shown

Attribute families: global, aria, data. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.

Flags and cases

A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.

No flags of its own.

Events

Every element also takes the props, the events and the attribute families listed on every element.

Slots

children

Parts

The parts of Fab are written under its name, inside it. Each is described here, with what it takes.

Fab.Action

One more action the button opens: its words and its icon; on click is what it does.

Fab.Action(_ label: String, icon: String) { … }
Props of Fab.Action
PropTypeUnsetMeaning

label

String (positional)

—

The action's words, shown beside its icon while the dial is open

icon:

String

none

An icon before the words, one of the built-in icon names

Drawn for it

What Fab draws itself, by the class a stylesheet can select. They are not written.

Drawn for it
PartClassMeaning

Fab.Trigger

—

Its button.

Renders with the class wf-fab, stable across releases, so a stylesheet may target it.

These controls list the props' cases; the example below shows them written.