GuidesComponentsLanguageSwitcher

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

Component Behavior

Selection Logic

  • Compares own value prop with parent's selectedLanguage
  • Automatically manages visual selection state
  • Triggers parent onLanguageChange when 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 color
  • theme.colors.onSurfaceDisabled - Unselected border color
  • theme.colors.surface - Background color
  • theme.spacing(2) - Internal gap and padding (8px default)
  • theme.borderRadius(2) - Corner radius (8px default)

Last updated on

On this page