Usage
SwiftUI
M3EIconButton("star", variant: .filled) { favorite() }
M3EIconButton("share", width: .wide, variant: .tonal) {}
M3EIconToggleButton("favorite_border", checkedIcon: "favorite", isOn: $liked, variant: .tonal)API
| Property | SwiftUI | Description |
|---|---|---|
| icon | _ icon: String | The icon. |
| variant | .standard .filled .tonal .outlined | Color style. |
| width | .narrow .standard .wide | Container width. |
| size | M3EButtonSize | Same five sizes as buttons. |
| accessibilityLabel | accessibilityLabel: 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.