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

Field with Hint

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

A labelled field with helper hint text.

Inputs · SwiftUI · iOS 17

  • inputs
  • swiftui

The actual source

LabelHintField.swift
// Field with Hint · syxUI · https://syxui.dev/components/inp-label-hint
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

// Label + field + hint
struct LabelHintField: View {
    var body: some View {
        VStack(alignment: .leading, spacing: 6) {
            Text("Username").font(.system(size: 13, weight: .medium))
            HStack { Text("jane_doe").font(.system(size: 16)); Spacer() }.padding(.horizontal, 14).padding(.vertical, 13).overlay(RoundedRectangle(cornerRadius: 12, style: .continuous).stroke(Color.primary.opacity(0.15), lineWidth: 1))
            Text("This will be your public handle.").font(.system(size: 12)).foregroundStyle(.secondary)
        }.frame(width: 300)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17