
Password Field
From syxUI — written for both platforms, not translated between them.
A password field input — self-contained SwiftUI, styled from system tokens.
Inputs · SwiftUI · iOS 17
- inputs
- swiftui
The actual source
PasswordField.swift
// Password Field · syxUI · https://syxui.dev/components/input-password
// Free in any project. Keep this line and credit syxUI where a person can read it.
import SwiftUI
extension View {
func formaCard(_ pad: CGFloat = 18) -> some View {
self.padding(pad)
.background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: 20, style: .continuous))
.overlay(RoundedRectangle(cornerRadius: 20, style: .continuous).stroke(Color.primary.opacity(0.06), lineWidth: 1))
.shadow(color: .black.opacity(0.05), radius: 14, x: 0, y: 6)
}
}
// 14. Password field with strength
struct PasswordField: View {
var body: some View {
VStack(alignment: .leading, spacing: 10) {
HStack {
Text("••••••••••").font(.system(size: 18, weight: .medium)).tracking(1)
Spacer()
Image(systemName: "eye.fill").foregroundStyle(.secondary)
}
.padding(.horizontal, 14).padding(.vertical, 15)
.overlay(RoundedRectangle(cornerRadius: 12).stroke(Color.primary, lineWidth: 1.6))
HStack {
Text("Password strength").font(.system(size: 12)).foregroundStyle(.secondary)
Spacer()
Text("Strong").font(.system(size: 12, weight: .semibold))
}
GeometryReader { g in
ZStack(alignment: .leading) {
Capsule().fill(Color.primary.opacity(0.10)).frame(height: 5)
Capsule().fill(Color.primary).frame(width: g.size.width * 0.85, height: 5)
}
}.frame(height: 5)
}
.formaCard()
}
}
iOS 17 · 1 dependencies
Dependencies
- SwiftUI
- formaCard
Requires iOS 17


