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

Validated Field

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

A field in a success / validated state.

Inputs · SwiftUI · iOS 17

  • inputs
  • swiftui

The actual source

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

import SwiftUI

// Success / validated field
struct SuccessField: View {
    let green = Color(red: 0.16, green: 0.66, blue: 0.40)
    var body: some View {
        VStack(alignment: .leading, spacing: 6) {
            HStack { Text("jane@example.com").font(.system(size: 16)); Spacer(); Image(systemName: "checkmark.circle.fill").foregroundStyle(green) }.padding(.horizontal, 14).padding(.vertical, 14).overlay(RoundedRectangle(cornerRadius: 12, style: .continuous).stroke(green, lineWidth: 1.5))
            Text("Looks good!").font(.system(size: 12)).foregroundStyle(green).padding(.leading, 4)
        }.frame(width: 300)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17