---
title: "Language Select · Ark UI — StyleX Blocks"
description: "Locale picker with native language names, English hints, and BCP-47 values — ready for i18n and profile settings forms."
url: "https://stylexblocks.com/block/ark-ui/language-select/"
agent:
  instructions: "Use this search API to find relevant components and blocks across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://stylexblocks.com/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Language Select block

Locale picker with native language names, English hints, and BCP-47 values — ready for i18n and profile settings forms.

- Behavior engine: Ark UI
- Also available for: [Base UI](https://stylexblocks.com/block/base-ui/language-select.md), [UI SDK](https://stylexblocks.com/block/ui-sdk/language-select.md)
- Category: [Pickers](https://stylexblocks.com/blocks/pickers.md)
- Built with: [Select](https://stylexblocks.com/components/ark-ui/select.md)
- HTML page: https://stylexblocks.com/block/ark-ui/language-select/

## Install

Configure the project once (sets the behavior engine and import aliases):

```sh
npx stylexblocks init
```

Then add the item as source you own:

```sh
npx stylexblocks add language-select
```

Equivalent: `npx shadcn add @stylexblocks/language-select`. Registry item JSON: https://stylexblocks.com/r/ark-ui/language-select.json

## Usage

```tsx
import { LanguageSelect } from "#components/blocks/ark-ui/language-select.tsx";

export function Example() {
  return (
    <LanguageSelect
      name="locale"
      defaultValue="en"
      onValueChange={(locale) => {
        // BCP-47 tag, e.g. "en"
      }}
    />
  );
}
```

## Source

`components/blocks/ark-ui/language-select.tsx`

```tsx
import * as stylex from "@stylexjs/stylex";
import { useMemo } from "react";
import {
  Select,
  createListCollection,
  type SelectVariantProps,
} from "#components/ui/ark-ui/select.tsx";
import { semanticColors } from "@stylexblocks/ui/semantic-tokens/colors.stylex.ts";
import type { StyleOverrideProps } from "#lib/recipe-props.ts";

export interface Language {
  /** BCP-47 language tag, e.g. "pt-BR" — what your backend receives. */
  value: string;
  /** Native name, shown in the control. */
  label: string;
  /** English name, shown as a secondary hint in the list. */
  english: string;
}

export const languages: Language[] = [
  { value: "en", label: "English", english: "English" },
  { value: "zh-Hans", label: "简体中文", english: "Chinese (Simplified)" },
  { value: "nl", label: "Nederlands", english: "Dutch" },
  { value: "fr", label: "Français", english: "French" },
  { value: "de", label: "Deutsch", english: "German" },
  { value: "it", label: "Italiano", english: "Italian" },
  { value: "ja", label: "日本語", english: "Japanese" },
  { value: "ko", label: "한국어", english: "Korean" },
  { value: "pt-BR", label: "Português (Brasil)", english: "Portuguese (Brazil)" },
  { value: "es", label: "Español", english: "Spanish" },
];

const styles = stylex.create({
  english: {
    color: semanticColors.fgSubtle,
    fontSize: "0.8125em",
    marginInlineStart: "auto",
    paddingInlineStart: "0.75rem",
  },
});

export interface LanguageSelectProps extends SelectVariantProps, StyleOverrideProps {
  label?: string;
  /** BCP-47 tag of the initial selection. */
  defaultValue?: string;
  /** BCP-47 tag of the controlled selection. */
  value?: string;
  onValueChange?: (locale: string) => void;
  /** Posts the selection with native form submits via a hidden select. */
  name?: string;
  /** Override the offered locales; defaults to the ten most common. */
  items?: Language[];
  disabled?: boolean;
}

/**
 * LanguageSelect — locale picker for settings and onboarding forms. Shows
 * native language names with English hints, speaks BCP-47 on the wire.
 */
export function LanguageSelect({
  label = "Language",
  defaultValue,
  value,
  onValueChange,
  name,
  items = languages,
  disabled,
  variant,
  size,
  palette,
  style,
}: LanguageSelectProps) {
  const collection = useMemo(
    () =>
      createListCollection({
        items,
        itemToString: (item: Language) => item.label,
        itemToValue: (item: Language) => item.value,
      }),
    [items],
  );
  return (
    <Select.Root
      collection={collection}
      name={name}
      disabled={disabled}
      defaultValue={defaultValue ? [defaultValue] : undefined}
      value={value ? [value] : undefined}
      onValueChange={(details) => onValueChange?.(details.value[0] ?? "")}
      variant={variant}
      size={size}
      palette={palette}
      style={style}
    >
      <Select.Label>{label}</Select.Label>
      <Select.Control>
        <Select.Trigger>
          <Select.ValueText placeholder="Select language" />
        </Select.Trigger>
        <Select.IndicatorGroup>
          <Select.Indicator />
        </Select.IndicatorGroup>
      </Select.Control>
      <Select.Positioner>
        <Select.Content>
          {items.map((lang) => (
            <Select.Item key={lang.value} item={lang}>
              <Select.ItemText>{lang.label}</Select.ItemText>
              <span {...stylex.props(styles.english)}>{lang.english}</span>
              <Select.ItemIndicator />
            </Select.Item>
          ))}
        </Select.Content>
      </Select.Positioner>
      <Select.HiddenSelect />
    </Select.Root>
  );
}
```
