
Icon Picker
From syxUI — written for both platforms, not translated between them.
A grid of SF Symbol icons with one selected.
Inputs · SwiftUI · iOS 17
- inputs
- swiftui
The actual source
IconPickerCard.swift
// Icon Picker · syxUI · https://syxui.dev/components/sel-icon-grid
// Free in any project. Keep this line and credit syxUI where a person can read it.
import SwiftUI
extension View {
func formaCard(_ pad: CGFloat = 18) -> some View {
self.padding(pad)
.background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: 20, style: .continuous))
.overlay(RoundedRectangle(cornerRadius: 20, style: .continuous).stroke(Color.primary.opacity(0.06), lineWidth: 1))
.shadow(color: .black.opacity(0.05), radius: 14, x: 0, y: 6)
}
}
// Icon picker grid
struct IconPickerCard: View {
@State private var sel = 3
let blue = Color(red: 0.0, green: 0.47, blue: 1.0)
let icons = ["house.fill", "star.fill", "heart.fill", "flag.fill", "bell.fill", "bookmark.fill", "tag.fill", "bolt.fill"]
var body: some View {
VStack(alignment: .leading, spacing: 12) {
Text("Choose an icon").font(.system(size: 15, weight: .semibold))
LazyVGrid(columns: Array(repeating: GridItem(.flexible(), spacing: 10), count: 4), spacing: 10) {
ForEach(Array(icons.enumerated()), id: \.offset) { i, ic in
let on = sel == i
Image(systemName: ic).font(.system(size: 18)).foregroundStyle(on ? .white : .primary)
.frame(maxWidth: .infinity).frame(height: 48)
.background(on ? blue : Color.primary.opacity(0.05), in: RoundedRectangle(cornerRadius: 12, style: .continuous))
.onTapGesture { sel = i }
}
}
}.formaCard().frame(width: 300)
}
}
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


