
Button Group
From syxUI — written for both platforms, not translated between them.
Three connected segmented buttons.
Buttons · SwiftUI · iOS 17
- buttons
- swiftui
The actual source
SegmentedButtonCard.swift
// Button Group · syxUI · https://syxui.dev/components/btn-segmented
// Free in any project. Keep this line and credit syxUI where a person can read it.
import SwiftUI
let btnBlue = Color(red: 0.0, green: 0.47, blue: 1.0)
// Connected button group
struct SegmentedButtonCard: View {
var body: some View {
HStack(spacing: 0) {
ForEach(Array(["Day", "Week", "Month"].enumerated()), id: \.offset) { i, t in
Text(t).font(.system(size: 14, weight: .medium)).foregroundStyle(i == 0 ? .white : .primary).frame(maxWidth: .infinity).padding(.vertical, 11).background(i == 0 ? btnBlue : Color.primary.opacity(0.05))
if i < 2 { Divider().frame(height: 20) }
}
}.clipShape(RoundedRectangle(cornerRadius: 12, style: .continuous)).overlay(RoundedRectangle(cornerRadius: 12, style: .continuous).stroke(Color.primary.opacity(0.1), lineWidth: 1)).frame(width: 300)
}
}
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


