SecureField

Collect passwords with masked input, autofill, and an optional reveal button.

SecureField is a TextField preset that masks entered text. It keeps the same binding, keyboard, icon, accessory, and submission properties.

Read the TextField guide for the inherited keyboard, icon, clear-button, and accessory behavior.

var password = new SecureField
{
    Placeholder = "Password",
    ContentKind = ContentKind.Password,
    LeadingIcon = ImageSource.Symbol("lock"),
    RevealButton = true,
    ReturnKey = ReturnKeyType.Go,
    SubmitCommand = viewModel.SignInCommand,
    Text = Bind(vm => vm.Password)
        .TwoWay((vm, val) => vm.Password = val)
};

RevealButton adds an eye button in the trailing slot. Toggling it preserves focus, entered text, and the current selection. As with TextField, a custom trailing icon and the built-in trailing behavior occupy the same area; use one clear purpose for that slot.

Choose the correct ContentKind so Password AutoFill can distinguish existing passwords from new-password creation. Avoid logging the field value, persisting it as plain text, or copying it into labels for validation feedback.

The reveal button is a convenience, not a change in data handling: while revealed, the underlying value is still the same bound string. Clear sensitive view-model state when the flow finishes.