Toolbars
ExpressiveDocked and floating toolbars of related actions, with an optional FAB, scroll collapse and scroll exit.
import { FloatingToolbar, DockedToolbar, ToolbarFab, useToolbarScrollExpansion, useToolbarScrollExit } from '@windmorph/react';Purpose
Toolbars gather a set of related actions. A DockedToolbar is a full-width 64px bar, usually along the bottom of the window (it replaces the bottom app bar). Its items sit centred 32px apart by default; for the spec's alternative, centred 8px apart, add className="gap-2". In compact windows, spread them evenly with arrangement="space-between". Like the floating toolbar, it comes in standard or vibrant colours (color). A FloatingToolbar is a pill that floats above the content, horizontal (16px from the window's edge) or vertical (24px), in standard or vibrant colours. It is elevated by default; set elevated={false} over visually distinct content. Avoid square icon buttons in it, and wide ones in a vertical toolbar (development warnings flag both).
Icon buttons take the toolbar's colours: standard buttons are on-surface-variant in a standard toolbar and on-primary-container in a vibrant one, where a selected tonal toggle turns surface-container / on-surface. When the actions don't fit, as in compact windows, put the rest in an overflow menu: a MenuTrigger with an icon button at the end of a docked toolbar, or in a floating toolbar's trailing slot.
A floating toolbar's leading and trailing groups collapse with expanded; alternatively pair it with a fab (a ToolbarFab), and collapsing hides the toolbar while the FAB grows. useToolbarScrollExpansion derives expanded from a scroll container. Either toolbar can instead leave the screen on scroll: useToolbarScrollExit drives its visible prop (and exitEdge picks the floating toolbar's edge). Use one behaviour or the other, never both: a development warning flags a floating toolbar that is collapsed and hidden at once. Pair a floating toolbar with a FAB, not an extended FAB (also flagged in development).
When not to use
For the screen title and global actions use a Top app bar.
See also
- Toolbars on m3.material.io: Material's own guidelines, with anatomy and specs.
- Top app bar: A header with the screen title and actions, in three sizes, with scroll behaviour.
- FAB: A screen's single most important action, as an icon or an extended label.
- Icon button: A compact icon-only action; requires an accessible name.