Usage
SwiftUI
M3EButton("Continue", icon: "arrow_forward", size: .medium) { next() }
M3EButton("Tonal", variant: .tonal) {}
M3EButton("Square", size: .large, shape: .square) {}
M3EToggleButton("Bold", icon: "format_bold", isOn: $bold)API
| Property | SwiftUI | Description |
|---|---|---|
| label | _ label: String | Button text. |
| icon | icon: String? | Leading icon. Material Symbols name on Swift and RN. |
| size | .extraSmall … .extraLarge | Container height 32 / 40 / 56 / 96 / 136. |
| variant | .filled .tonal .elevated .outlined .text | Color style. |
| shape | .round | .square | Resting shape. Pressing always morphs to a tighter corner. |
| checked | M3EToggleButton(isOn:) | Toggle state; round buttons turn square when checked. |
| fillWidth | fillWidth: Bool | Stretch to the available width. |
| overrides | overrides: M3EOverrides | Escape hatches that win over the tokens. |
Guidelines
- Use one filled button per area for the primary action; use tonal or outlined for secondary actions.
- Pick size by importance and touch target, not by text length. Small (40dp) is the default.
- Keep labels short verbs: “Save”, “Continue”, “Start run”.
- Use a toggle button for a persistent on/off state such as text formatting; use a switch for settings.