
Top Segmented
From syxUI — written for both platforms, not translated between them.
A two-option top segmented control.
Navigation · SwiftUI · iOS 17
- navigation
- swiftui
The actual source
TopSegmentedNav.swift
// Top Segmented · syxUI · https://syxui.dev/components/nav2-segmented
// Free in any project. Keep this line and credit syxUI where a person can read it.
import SwiftUI
let navBlue = Color(red: 0.0, green: 0.47, blue: 1.0)
// Top segmented control (Evernote)
struct TopSegmentedNav: View {
@State private var sel = 0
let opts = ["Standard", "AI-Powered"]
var body: some View {
HStack(spacing: 0) {
ForEach(Array(opts.enumerated()), id: \.offset) { i, o in
Text(o).font(.system(size: 14, weight: .medium)).foregroundStyle(sel == i ? navBlue : Color.secondary).frame(maxWidth: .infinity).padding(.vertical, 9).background(sel == i ? Color(.systemBackground) : .clear, in: RoundedRectangle(cornerRadius: 8)).shadow(color: .black.opacity(sel == i ? 0.08 : 0), radius: 3, y: 1).padding(3).onTapGesture { sel = i }
}
}.background(Color.primary.opacity(0.06), in: RoundedRectangle(cornerRadius: 11)).frame(width: 280)
}
}
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


