Icon button
ExpressiveA compact icon-only action; requires an accessible name.
import { IconButton } from '@windmorph/react';Purpose
Icon buttons trigger an action with just an icon, so they suit toolbars, list rows and dense layouts where a labelled Button would not fit. Use one only when the icon's meaning is unambiguous.
Because there is no visible text, an accessible name is required: every icon button must pass aria-label or aria-labelledby (the types enforce it).
Icons
- Use a system icon whose meaning is clear on its own (search, delete, share), not a decorative or custom one people have to learn.
- The icon fills its slot: an
svg, or a single element that holds one directly, such as a wrapper for an icon with a mark on its corner (ansvgwith only aviewBoxthen fills the wrapper). Anything else keeps its own size, centred: aBadgedBoxkeeps its 24px icon, so the badge stays on the icon's corner at every size. - For a toggle, show the outlined icon when unselected and its filled form when selected (
selectedIcon). If an icon has no filled version, use a semibold weight of it for the selected state instead. - Set
pendingwhile an action the button started runs (a refresh, a sync): the icon gives way to a loading indicator after 200ms and the button keeps its size and focus. Don't give every icon button in a list a pending state, and announce the result yourself.
Do and don't
When not to use
When the action has a short text label, use a Button so the label is visible.
See also
- Icon button on m3.material.io: Material's own guidelines, with anatomy and specs.
- Button: Five variants and five sizes for text actions, with a toggle form and a press morph.
- FAB: A screen's single most important action, as an icon or an extended label.
- Toolbars: Docked and floating toolbars of related actions, with an optional FAB, scroll collapse and scroll exit.