Skip to main content
239

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Themes
React Native docs
ActionsReact Native

Language toggle

Cycle to the next locale with a pill that shows that locale.

Public APILumenLanguageToggleReact Native

Native example

Use Language toggle

Use it for two or three locales. The host applies the locale; use a select for longer lists.

Language toggle rendered in the Expo web renderer Lumen playground

Captured exampleExpo web renderer

Open interactive preview
Open the Language toggle demo
tsx
import { useState } from 'react'
import { LumenLanguageToggle } from '@santi020k/lumen-react-native'

export const LanguageSwitch = () => {
  const [locale, setLocale] = useState('en')

  return (
    <LumenLanguageToggle
      locales={[
        { label: 'English', value: 'en' },
        { label: 'Español', value: 'es' }
      ]}
      onValueChange={setLocale}
      value={locale}
    />
  )
}
React Native
A pill that cycles to the next locale, shows it, and names the change for assistive technology.

Reference

Public API

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

APIValues or typeDefaultDescription
value / locales / labelTemplatecurrent locale / label and value pairs / accessible name templatefirst locale / English, Español / Change language from {current} to {next}Use it for two or three locales.

Native behavior

Design and accessibility

When to use it

Use it for two or three locales. The host applies the locale; use a select for longer lists.

Accessibility

The label reads the current and the next language.

Shared component

Available on other platforms

Apple / SwiftUIAndroid / Compose Web
React Native docsNative primitives