Secure Field

macOS 13.3+

Displays an obscured text input for passwords and other sensitive text.

import SwiftUIstruct SecureFieldUsageExample: View {    @State private var password = "supersecret"    var body: some View {        FLXFieldLabel("Password") {            FLXSecureField("Password", text: $password)        }        .padding(FLXSpacing.xl)    }}

Installation

Requires the design system foundation (tokens and theme).

pnpm dlx shadcn@latest add https://swiftui.flexnative.com/r/mac-secure-field.json

Usage

FLXSecureField("Password", text: $password)

SecureField is a separate native control from TextField: it hides typed characters and blocks cut/copy.

On macOS, the border takes the theme's ring color while the field has focus, since the Mac doesn't draw its own focus ring around it.

Custom styling

TextFieldStyle doesn't support custom conformances, so there's no FLXSecureFieldStyle or override.

API Reference

FLXSecureField

init(    _ titleKey: LocalizedStringResource = "",    text: Binding<String>)init<S: StringProtocol>(    _ title: S,    text: Binding<String>)

For more information about FLXSecureField props, see the Apple documentation.