Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
Android docs
FormsAndroid

Character count

Show how many characters remain for a text field.

Public APILumenCharacterCountAndroid / Compose

Native example

Use Character count

It never truncates; validate the limit on submit.

Character count rendered in the Android phone emulator Lumen playground
Captured exampleAndroid phone emulatorView dark appearance
kotlin
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.runtime.*
import com.santi020k.lumen.*

@Composable
fun BioField() {
    var bio by remember { mutableStateOf("") }
    Column(verticalArrangement = Arrangement.spacedBy(LumenSpacing.Xs)) {
        LumenTextarea(value = bio, onValueChange = { bio = it }, label = "Bio", minLines = 3)
        LumenCharacterCount(text = bio, max = 160)
    }
}
Android
A bio field with a grapheme-aware counter that warns near the limit and announces only threshold crossings.

Reference

Public API

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

APIValues or typeDefaultDescription
max / value / announceAtlimit / current text / thresholdsrequired / required / 20, 10, 0It never truncates; validate the limit on submit.

Native behavior

Design and accessibility

When to use it

It never truncates; validate the limit on submit.

Accessibility

Counts graphemes and announces only at thresholds and at the limit.

Shared component

Available on other platforms

React NativeApple / SwiftUI Web
Android docsCompose module