Stylish Secure Text Field
A secure single-line text field for password-like input, wrapping the Material 3 SecureTextField with the theme's defaults.
The field is designed for secret input: it masks the text with StylishObfuscationCharacter, disables auto-correct, and uses a password keyboard type by default. The masking mode can be tuned via textObfuscationMode (e.g. TextObfuscationMode.RevealLastTyped, the default, briefly reveals the most recent character).
Unlike the string-based text fields, this component operates on a hoisted TextFieldState (see androidx.compose.foundation.text.input.TextFieldState) instead of value/onValueChange callbacks; the state owns the text and selection and survives recomposition.
Parameters
The TextFieldState holding the field's text and selection. Callers typically create it with remember { TextFieldState() } and hoist it.
Modifier applied to the SecureTextField root.
When false, the field rejects input and renders in Material's disabled color scheme. Defaults to true.
Typography for the input text. Defaults to LocalTextStyle.
The position of label relative to the field. Defaults to TextFieldLabelPosition.Attached.
Optional label composable displayed with the field.
Optional hint composable shown when the field is empty.
Optional icon slot at the start of the field.
Optional icon slot at the end of the field (e.g. a visibility toggle).
Optional slot rendered inline before the input text.
Optional slot rendered inline after the input text.
Optional slot rendered below the field.
When true, the field renders its error indicator color.
Optional transformation applied to input as it is entered.
How the entered text is masked. Defaults to TextObfuscationMode.RevealLastTyped.
The character used to mask the text. Defaults to '\u2022' (bullet).
Software keyboard options for the field. Defaults to a password keyboard with auto-correct disabled.
Called when the user presses the IME action button or the enter key.
Callback executed when the text layout becomes queryable, receiving a function that returns the TextLayoutResult (or null when not yet laid out).
Shape of the field's container. Defaults to TextFieldDefaults.shape.
Color scheme for the field. Defaults to TextFieldDefaults.colors.
Padding separating the input text from the field's surroundings. Defaults to Material's label-aware padding.
The MutableInteractionSource for the field, used to observe focus/press/hover interactions. When null, an internal one is remembered.