Skip to main content

Module password_field

Module password_field 

Source
Expand description

PasswordField — secure single-line text entry with a reveal toggle, masking, Caps Lock warning, and clipboard protection.

A thin, ergonomic preset over a secure TextInputField composed SpinBox-style: the field + an embedded reveal button live inside one bordered frame with a unified focus halo. Masking happens at the text-engine layer (one echo glyph per source char), so the plaintext never reaches the shaper or glyph atlas while masked, and caret / selection / hit-test stay correct.

Feature parity target: Qt QLineEdit echo modes, SwiftUI SecureField, WinUI PasswordBox / PasswordRevealMode, and the Android password_toggle.

§Example

let password = ctx.signal(String::new());
PasswordField::new(password.clone())
    .label(tr!(password()))               // or .label(lit!("Password"))
    .placeholder(tr!(password_hint()))    // i18n-first; `_literal` twins bypass i18n
    .validator(|s| if s.len() >= 8 {
        ValidationOutcome::Valid
    } else {
        ValidationOutcome::Invalid { message: "Too short".into() }
    })

Re-exports§

pub use crate::primitives::text_input_field::AtRevealPolicy;
pub use crate::primitives::text_input_field::EchoMode;

Structs§

PasswordField
Secure single-line text entry. See the module docs.

Enums§

RevealMode
How the reveal affordance behaves. Mirrors WinUI’s PasswordRevealMode.