
Combobox
From syxUI — written for both platforms, not translated between them.
A typeahead combobox with matches.
Navigation · SwiftUI · iOS 17
- navigation
- swiftui
The actual source
MenuCombobox.swift
// Combobox · syxUI · https://syxui.dev/components/menu-combobox
// Free in any project. Keep this line and credit syxUI where a person can read it.
import SwiftUI
let mnBlue = Color(red: 0.0, green: 0.47, blue: 1.0)
func menuCard<C: View>(_ w: CGFloat, @ViewBuilder _ c: () -> C) -> some View {
c().frame(width: w).background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: 14, style: .continuous)).overlay(RoundedRectangle(cornerRadius: 14, style: .continuous).stroke(Color.primary.opacity(0.07), lineWidth: 1)).shadow(color: .black.opacity(0.06), radius: 14, y: 5)
}
struct MenuCombobox: View { var body: some View { VStack(spacing: 6) { HStack { Image(systemName: "magnifyingglass").font(.system(size: 14)).foregroundStyle(.secondary); Text("Fra").font(.system(size: 16)); Capsule().fill(mnBlue).frame(width: 2, height: 18); Spacer() }.padding(.horizontal, 12).padding(.vertical, 11).overlay(RoundedRectangle(cornerRadius: 12, style: .continuous).stroke(mnBlue, lineWidth: 1.5)); menuCard(280) { VStack(spacing: 0) { ForEach(Array(["France", "French Guiana", "Franceville"].enumerated()), id: \.offset) { i, o in HStack { (Text("Fra").fontWeight(.semibold) + Text(String(o.dropFirst(3)))).font(.system(size: 15)); Spacer() }.padding(.horizontal, 14).padding(.vertical, 10); if i < 2 { Divider() } } } } }.frame(width: 300) } }
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


