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

Prefix Field

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

A field with a fixed prefix segment.

Inputs · SwiftUI · iOS 17

  • inputs
  • swiftui

The actual source

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

import SwiftUI

// Prefix field
struct PrefixField: View {
    var body: some View {
        HStack(spacing: 0) {
            Text("linkedin.com/in/").font(.system(size: 15)).foregroundStyle(.secondary).padding(.horizontal, 12).padding(.vertical, 14).background(Color.primary.opacity(0.05))
            Text("janedoe").font(.system(size: 15)).padding(.horizontal, 12)
            Spacer()
        }.overlay(RoundedRectangle(cornerRadius: 12, style: .continuous).stroke(Color.primary.opacity(0.15), lineWidth: 1)).clipShape(RoundedRectangle(cornerRadius: 12, style: .continuous)).frame(width: 300)
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17