LanguageSwitcher.Option
A touchable option component for individual language selection. Provides context for its child components and handles selection state, styling, and interaction feedback with Material Design 3 theming.
- Stable unknown
- Release candidate since 1.16.1-rc.3
- Development since 1.16.1-dev.2111+9796905
A touchable option component for individual language selection. Provides context for its child components and handles selection state, styling, and interaction feedback with Material Design 3 theming.
Basic Example
import { LanguageSwitcher } from "@ovok/native";
import * as React from "react";
const BasicLanguageSwitcherOption = () => (
// This component needs to be wrapped in a LanguageSwitcher component to work
<LanguageSwitcher selectedLanguage="en_US" onLanguageChange={() => {}}>
<LanguageSwitcher.Option value="en_US">
<LanguageSwitcher.Option.RadioButton />
<LanguageSwitcher.Option.Label>English</LanguageSwitcher.Option.Label>
</LanguageSwitcher.Option>
</LanguageSwitcher>
);
export default BasicLanguageSwitcherOption;Props
Every prop, with its type and description, is listed in the @ovok/native/language-switcher API reference.
Compound Components
LanguageSwitcher.Option.RadioButton- Radio button selection controlLanguageSwitcher.Option.Label- Language name display componentLanguageSwitcher.Option.Flag- Flag display component
Component Behavior
Selection Logic
- Compares own
valueprop with parent'sselectedLanguage - Automatically manages visual selection state
- Triggers parent
onLanguageChangewhen pressed - Provides selection context to child components
Visual States
- Selected: Primary border color and background emphasis
- Unselected: Disabled border color and transparent background
- Pressed: Touch opacity feedback for interaction
- Disabled: Reduced opacity and disabled interactions
Styling
Theme Colors Used
theme.colors.primary- Selected border colortheme.colors.onSurfaceDisabled- Unselected border colortheme.colors.surface- Background colortheme.spacing(2)- Internal gap and padding (8px default)theme.borderRadius(2)- Corner radius (8px default)
Last updated on
LanguageSwitcher
A provider component that manages language selection state through React Context API. Serves as the main container for language option components with automatic state management and theme integration.
LanguageSwitcher.Option.RadioButton
A radio button control component that automatically manages selection state based on the parent language option context. Built on react-native-paper RadioButton.Android with disabled pointer events for seamless parent option interaction.