Skip to content
Filter Pills preview
Rendered from the SwiftUI source on this page.

Filter Pills

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

Selected / unselected filter pills.

Badges · SwiftUI · iOS 17

  • badges
  • swiftui

The actual source

FilterTags.swift
// Filter Pills · syxUI · https://syxui.dev/components/tag-filter
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Filter / segment pills
struct FilterTags: View {
    var body: some View {
        HStack(spacing: 8) {
            Text("All").font(.system(size: 13, weight: .semibold)).foregroundStyle(.white).padding(.horizontal, 14).padding(.vertical, 7).background(Color.primary, in: Capsule())
            ForEach(["Active", "Archived"], id: \.self) { t in Text(t).font(.system(size: 13, weight: .medium)).padding(.horizontal, 14).padding(.vertical, 7).overlay(Capsule().stroke(Color.primary.opacity(0.2), lineWidth: 1)) }
        }
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17