Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Android docs
FormsAndroid

Secret value

Show a masked value, such as an API key, with show, hide, and copy actions.

Public APILumenSecretValueAndroid / Compose

Native example

Use Secret value

Load secrets on demand with loadValue and hide them after a delay. The mask never shows the value length.

Secret value rendered in the Android phone emulator Lumen playground
Captured exampleAndroid phone emulatorView dark appearance
kotlin
@Composable
fun DeveloperCredentials(apiKey: String, repository: CredentialsRepository) {
    Column(verticalArrangement = Arrangement.spacedBy(LumenSpacing.Lg)) {
        LumenSecretValue(label = "API key", value = apiKey)
        LumenSecretValue(
            label = "Webhook signing secret",
            loadValue = { repository.revealWebhookSecret() },
            autoHideAfterMillis = 30_000L,
            maskLength = 12
        )
    }
}
Android
A masked API key the user can reveal and copy, and a webhook secret fetched on demand that hides again after 30 seconds.

Reference

Public API

The primary shared and platform-specific options exposed by LumenSecretValue.

APIValues or typeDefaultDescription
label / value or loadValue / autoHideAfterfield name / secret or loader / auto-hide delayrequired / required / neverLoad secrets on demand with loadValue and hide them after a delay.

Native behavior

Design and accessibility

When to use it

Load secrets on demand with loadValue and hide them after a delay. The mask never shows the value length.

Accessibility

The toggle exposes expanded state, and loading, hiding, and copy results are announced.

Shared component

Available on other platforms

React NativeApple / SwiftUI Web
Android docsCompose module