← Components / Actions

Icon button

Compact actions with an icon only. The narrow and wide widths come from M3 Expressive; toggles swap the icon and fill when checked.

SwiftUIReact Native · Coming soonFlutter · Coming soon

Usage

SwiftUI
M3EIconButton("star", variant: .filled) { favorite() }
M3EIconButton("share", width: .wide, variant: .tonal) {}
M3EIconToggleButton("favorite_border", checkedIcon: "favorite", isOn: $liked, variant: .tonal)

API

PropertySwiftUIDescription
icon_ icon: StringThe icon.
variant.standard .filled .tonal .outlinedColor style.
width.narrow .standard .wideContainer width.
sizeM3EButtonSizeSame five sizes as buttons.
accessibilityLabelaccessibilityLabel: String?Required for screen readers: icons have no text.

Guidelines

  • Always pass an accessibility label.
  • Use filled or tonal for an important single action, standard for toolbars and app bars.