Skip to content
Applied Filters preview
Rendered from the SwiftUI source on this page.

Applied Filters

From syxUI — written for both platforms, not translated between them.

Search with applied filter tags.

Inputs · SwiftUI · iOS 17

  • inputs
  • swiftui

The actual source

SearchTags.swift
// Applied Filters · syxUI · https://syxui.dev/components/search-tags
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let seBlue = Color(red: 0.0, green: 0.47, blue: 1.0)

func searchField(_ placeholder: String) -> some View {
    HStack(spacing: 8) { Image(systemName: "magnifyingglass").font(.system(size: 15)).foregroundStyle(.secondary); Text(placeholder).font(.system(size: 16)).foregroundStyle(.secondary); Spacer() }.padding(.horizontal, 12).padding(.vertical, 11).background(Color.primary.opacity(0.06), in: RoundedRectangle(cornerRadius: 12, style: .continuous))
}

// Applied filter tags
struct SearchTags: View {
    var body: some View {
        VStack(alignment: .leading, spacing: 10) {
            searchField("Search")
            HStack(spacing: 8) { ForEach(["Under $50", "In Stock", "4★ & up"], id: \.self) { t in HStack(spacing: 5) { Text(t).font(.system(size: 12, weight: .medium)); Image(systemName: "xmark").font(.system(size: 9, weight: .bold)) }.foregroundStyle(seBlue).padding(.horizontal, 10).padding(.vertical, 6).background(seBlue.opacity(0.12), in: Capsule()) } }
        }.frame(width: 340)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17