inputs/DSSecureField

DSSecureField

inputs
since v1.0

Password input with a show/hide toggle. Shares the same visual language as DSTextField.

iOS 17+macOS 14+

Purpose

Use for all password and sensitive data entry. Never use a plain DSTextField for passwords.

Interactive Reference

Live showroom

Need the full visual surface?

Screenshots do not scale well across every component, state, and variant. For the real interactive reference, import the package and launch DSShowcaseRoot().

Best for exploring:

variants, states, categories, and real app examples in one place.

States

hidden

Password masked with dots (default).

visible

Plain text, toggled by the eye icon.

focused

Primary-colour border.

error

Red border with an error message.

Props

PropTypeDefaultDescription
labelString?nilLabel above the field.
placeholderString""Placeholder text.
textreqBinding<String>Binding to the password value.
hintString?nilHelper text (e.g. password rules).
errorString?nilValidation error message.
isDisabledBoolfalseDisables the field.

Examples

Login form

Email + password pair.

swift
DSTextField(label: "Email", placeholder: "you@example.com", text: $email)
DSSecureField(label: "Password", placeholder: "••••••••", text: $password, error: passwordError)

Usage Guidelines

  • Always provide a 'Forgot password?' link near this field.
  • Never log or print the bound value.

Related Components