Skip to content
Currency Field preview
Rendered from the SwiftUI source on this page.

Currency Field

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

A large currency / amount field.

Inputs · SwiftUI · iOS 17

  • inputs
  • swiftui

The actual source

CurrencyField.swift
// Currency Field · syxUI · https://syxui.dev/components/inp-currency
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Currency / amount field
struct CurrencyField: View {
    var body: some View {
        HStack(spacing: 4) {
            Text("$").font(.system(size: 22, weight: .medium)).foregroundStyle(.secondary)
            Text("1,250").font(.system(size: 22, weight: .semibold))
            Text(".00").font(.system(size: 22, weight: .semibold)).foregroundStyle(.secondary)
            Spacer()
            Text("USD").font(.system(size: 13, weight: .medium)).foregroundStyle(.secondary).padding(.horizontal, 8).padding(.vertical, 4).background(Color.primary.opacity(0.06), in: Capsule())
        }.padding(.horizontal, 16).padding(.vertical, 14).overlay(RoundedRectangle(cornerRadius: 12, style: .continuous).stroke(Color.primary.opacity(0.15), lineWidth: 1)).frame(width: 300)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17