Skip to content
Solid Badges preview
Rendered from the SwiftUI source on this page.

Solid Badges

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

Solid promo badges - sale, new, hot.

Badges · SwiftUI · iOS 17

  • badges
  • swiftui

The actual source

SolidBadges.swift
// Solid Badges · syxUI · https://syxui.dev/components/tag-solid
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let tgGreen = Color(red: 0.16, green: 0.66, blue: 0.40)
let tgOrange = Color(red: 0.98, green: 0.55, blue: 0.10)
let tgRed = Color(red: 0.90, green: 0.24, blue: 0.28)

struct SolidBadges: View { var body: some View { HStack(spacing: 8) { ForEach(Array([("SALE", tgRed), ("NEW", tgGreen), ("HOT", tgOrange)].enumerated()), id: \.offset) { _, b in Text(b.0).font(.system(size: 12, weight: .bold)).foregroundStyle(.white).padding(.horizontal, 10).padding(.vertical, 5).background(b.1, in: Capsule()) } } } }
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17