Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
React Native docs
FormsReact Native

Character count

Show how many characters remain for a text field.

Public APILumenCharacterCountReact Native

Native example

Use Character count

It never truncates; validate the limit on submit.

Character count rendered in the Expo web renderer Lumen playground

Captured exampleExpo web renderer

Open interactive preview
Open the Character count demo
tsx
import { LumenCharacterCount, LumenTextarea } from '@santi020k/lumen-react-native'
import { useState } from 'react'
import { View } from 'react-native'

export function BioField() {
  const [bio, setBio] = useState('')

  return (
    <View style={{ gap: 6 }}>
      <LumenTextarea label="Bio" value={bio} onChangeText={setBio} />
      <LumenCharacterCount text={bio} max={160} />
    </View>
  )
}
React Native
A bio field with a counter that turns warning near the limit and announces thresholds while typing.

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

Apple / SwiftUIAndroid / Compose Web
React Native docsNative primitives