← Components / Actions

Button group

Groups related buttons. The connected type replaces the old segmented button: inner corners stay tight while the selected item morphs to fully round.

SwiftUIReact Native · Coming soonFlutter · Coming soon
DayWeekMonth

Usage

SwiftUI
M3EButtonGroup(items: [.init("Day"), .init("Week"), .init("Month")], selection: $range)
M3EButtonGroup(items: [.init("Bold", icon: "format_bold"), .init("Italic", icon: "format_italic")],
               selection: $styles, selectionMode: .multi, type: .standard)

API

PropertySwiftUIDescription
items[M3EButtonGroupItem]Label and/or icon per item.
selectionBinding<Set<Int>>Selected indexes.
modeselectionMode: .single .multiSelection behavior.
type.connected .standardConnected shares edges; standard spaces items apart.
size / variantsize, variantAs for buttons.

Guidelines

  • Use connected groups for mutually exclusive views (Day / Week / Month).
  • Keep labels to one or two words.