Menus & navigation
JS behaviour
Language menu
A locale switcher: the language code rolls inside the trigger and the pick posts through a hidden input.
Real scenarios
The component as it is used in a product — not a specimen grid.
Reading language
The trigger rolls the two-letter code; the panel is a plain listbox with a springy check. The hidden input posts as docsLang, so it drops into any plain form too.
Saved on the server: fa
What the app does with it
dir=rtl
فارسی و عربی از راست میآیند؛ چیدمان با propertyهای منطقی آینه میشود و --nx-dir حرکتها را برمیگرداند.
Vazirmatn
Fonts swap through :lang(fa), tracking tokens zero out for joined scripts, and numbers roll in each locale’s digits.
Important props
| Prop | Type | Default | What it does |
|---|---|---|---|
| languages | array | [] | Each language: id, name and short (the code shown in the trigger). |
| value / wire:model | string | null | The picked language. |
| name / label | string | language · «زبان» | The hidden input’s name and the accessible label. |
Snippet
<x-nx::language-menu name="lang" :value="$state['lang'] ?? 'fa'" wire:model.live="state.lang" :languages="[
['id' => 'fa', 'name' => 'فارسی', 'short' => 'FA'],
['id' => 'en', 'name' => 'English', 'short' => 'EN'],
]" />