
Icon Tabs
From syxUI — written for both platforms, not translated between them.
Icon-only top tabs with an underline.
Navigation · SwiftUI · iOS 17
- navigation
- swiftui
The actual source
IconTopTabs.swift
// Icon Tabs · syxUI · https://syxui.dev/components/nav2-icon-tabs
// 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)
// Icon-only top tabs
struct IconTopTabs: View {
@State private var sel = 1
let icons = ["square.grid.2x2", "list.bullet", "map", "heart"]
var body: some View {
HStack(spacing: 0) {
ForEach(Array(icons.enumerated()), id: \.offset) { i, ic in
VStack(spacing: 8) { Image(systemName: ic).font(.system(size: 18)).foregroundStyle(sel == i ? Color.primary : Color.secondary); Rectangle().fill(sel == i ? navBlue : .clear).frame(height: 2) }.frame(maxWidth: .infinity).onTapGesture { sel = i }
}
}.frame(width: 300)
}
}
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


