Skip to main content
Urbicon UI
source

LocaleSwitcher

Language selector — a convenience wrapper around the Select primitive, powered by the i18n system with flag support and the Select styling axes.

Playground

Variant
Size
<LocaleSwitcher
  showFlag
  size="sm"
  variant="outlined"
/>

01 Examples

Basic

Default trigger with flags; pass showFlag=false to drop them.
<LocaleSwitcher showFlag />
<LocaleSwitcher showFlag={false} />

In a settings panel

Realistic use — small outlined trigger inline with other preference rows.

Preferences

Language

Region

<div
  class="bg-surface-elevated border-border-subtle w-full overflow-hidden rounded-2xl border"
>
  <div class="border-border-subtle border-b px-5 py-3">
    <h3 class="text-text-primary text-sm font-semibold">Preferences</h3>
  </div>
  <div class="divide-border-subtle divide-y">
    <div class="flex items-center justify-between px-5 py-3">
      <p class="text-text-primary text-sm font-medium">Language</p>
      <LocaleSwitcher variant="outlined" size="sm" showFlag />
    </div>
    <div class="flex items-center justify-between px-5 py-3">
      <p class="text-text-primary text-sm font-medium">Region</p>
      <Select
        options={[
          { label: 'Europe', value: 'eu' },
          { label: 'North America', value: 'na' },
          { label: 'Asia', value: 'asia' }
        ]}
        value="eu"
        variant="outlined"
        size="sm"
      />
    </div>
  </div>
</div>

02 Customization

Branded trigger

Override the underlying Select trigger slot with a gradient brand-look.
<LocaleSwitcher
  showFlag
  slotClasses={{
    trigger:
      'bg-linear-to-r from-indigo-500 to-violet-500 text-white border-transparent shadow-md shadow-indigo-500/20 hover:from-indigo-600 hover:to-violet-600'
  }}
/>

03 Accessibility

Inherits the Select listbox semantics — role="listbox", aria-expanded, aria-selected — plus a trigger aria-label from the i18n bundle. navigate, Enter selects, Esc closes. Locale names resolve from the active translation bundle.

04 API Reference

5 props
5 props
Prop
Type
Default
Description

05 Types

Local type definitions used by this component.

4 types
Name
Kind
Category
Used by
Description

06 Installation

Import

import { LocaleSwitcher } from '@urbicon-ui/blocks';