Skip to content
Category Tags preview
Rendered from the SwiftUI source on this page.

Category Tags

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

Tinted category tag pills.

Badges · SwiftUI · iOS 17

  • badges
  • swiftui

The actual source

CategoryTags.swift
// Category Tags · syxUI · https://syxui.dev/components/tag-category
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let tgBlue = Color(red: 0.0, green: 0.47, blue: 1.0)
let tgPurple = Color(red: 0.55, green: 0.40, blue: 0.90)
let tgPink = Color(red: 0.95, green: 0.35, blue: 0.55)

func tagPill(_ text: String, _ color: Color) -> some View {
    Text(text).font(.system(size: 13, weight: .semibold)).foregroundStyle(color).padding(.horizontal, 12).padding(.vertical, 6).background(color.opacity(0.14), in: Capsule())
}

struct CategoryTags: View { var body: some View { HStack(spacing: 8) { tagPill("Design", tgBlue); tagPill("Dev", tgPurple); tagPill("Growth", tgPink) } } }
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17