🌈 Create new beautiful Compose Gradients with our new wesite ->
Class

TextObfuscationMode

Defines how the text will be obscured in secure text fields.

Source set: Common
public class TextObfuscationMode internal constructor(public val value: Int)

Defines how the text will be obscured in secure text fields.

Text obscuring refers to replacing the original text content with a mask via various methods. It is most common in password fields.

Users are generally accustomed to different default experiences for secure text input on various platforms. On desktop, the convention is to keep the input entirely hidden. Conversely, mobile platforms typically offer a brief reveal of the last typed character. This reveal lasts for a short duration or until another character is entered, aiding users in tracking their input while maintaining privacy by not exposing too much information.

Members

Companion

Source set: Common
public companion object

Properties

Visible

Source set: Common
public val Visible: TextObfuscationMode

Do not obscure any content, making all the content visible.

It can be useful when you want to briefly reveal the content by toggling a reveal icon.

RevealLastTyped

Source set: Common
public val RevealLastTyped: TextObfuscationMode

Reveals the last typed character for a short amount of time.

Forces reveal behavior regardless of platform settings. For platform-dependent behavior, e.g. Androids "Show Passwords" setting, use System.

Hidden

Source set: Common
public val Hidden: TextObfuscationMode

All characters are hidden.

System

Source set: Common
public val System: TextObfuscationMode

Gives the choice to the platform to hide or show characters.

On most platforms, the behavior depends on that platform's conventions (typically defaulting to Hidden).

Android Specific: If the system setting is set to "Show" this setting mimics RevealLastTyped, otherwise it mimics Hidden. Additionally, there are differences, depending on the SDK version:

    touch input and physical keyboard input.

  • SDK 37 and later: Respects granular platform settings that can differentiate between
  • (Settings.System.TEXT_SHOW_PASSWORD) for all input types.

  • Below SDK 37: Respects the system-wide "Show passwords" toggle