androidx.compose.foundation.text

BasicSecureTextField

Composable function · from org.jetbrains.compose.foundation:foundation:1.12.2

One of the basic text fields. It works like BasicTextField. Only the parameters that differ are described here.

A basic field for passwords. It hides the text, and doesn't allow copying it.

Parameters

@Composable
fun BasicSecureTextField(
    state: TextFieldState,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    readOnly: Boolean = false,
    inputTransformation: InputTransformation? = null,
    textStyle: TextStyle = TextStyle.Default,
    keyboardOptions: KeyboardOptions = KeyboardOptions.SecureTextField,
    onKeyboardAction: KeyboardActionHandler? = null,
    onTextLayout: (Density.(getResult: () -> TextLayoutResult?) -> Unit)? = null,
    interactionSource: MutableInteractionSource? = null,
    cursorBrush: Brush = SolidColor(Color.Black),
    decorator: TextFieldDecorator? = null,
    textObfuscationMode: TextObfuscationMode = TextObfuscationMode.System,
    textObfuscationCharacter: Char = DefaultObfuscationCharacter,
    scrollState: ScrollState = rememberScrollState(),
)

textObfuscationMode: TextObfuscationModeOptional

Default: TextObfuscationMode.System

How a password is hidden: always, or showing the last typed character for a moment.

textObfuscationCharacter: CharOptional

Default: DefaultObfuscationCharacter

The character shown instead of each letter. Default: a dot.

Defaults that differ from BasicTextField:

Same as in BasicTextField: state, modifier, enabled, readOnly, inputTransformation, textStyle, keyboardOptions, onKeyboardAction, onTextLayout, interactionSource, cursorBrush, decorator, scrollState.

Basic text fields