shadcn.io is not affiliated with official shadcn/ui
Language and Region Settings Block for React
A language and region settings panel: two selects over three cells that show what they do, a sort order made by the language's collation, a month marked with the region's first weekday, and units with a worked example.
Installation
Overview
Let people see what their language and region will change before they save it, with this language and region settings panel for React with Base UI. A compact header names the setting, and a hairline frame with a plus mark on each corner holds a band with two Native Selects, Language and Region, and one sentence that sums the choice up. Under it, three cells share hairlines. Sort order puts eight saved places in the order the chosen language's collation gives them, so Swedish ends with Å, Ä and Ö, English and German keep accents with their letter, Danish ends with Æ, Ø and Å, and Spanish puts Ñ after N. Week is a month with the region's first weekday marked, whether that is Monday, Sunday or Saturday. Units has a distance and a clock the region suggests, each with one example printed by the browser's own number and date formatting. The last band counts unsaved changes beside a Shine Button to save them and an outline Button to discard them. It's built from Native Select, Field, Button, Shine Button and Guides, with a CSS entrance only. For an account or workspace page, a travel or booking app, or any product that sorts names and shows dates.
FAQ
How do I add my own languages, regions and places?
Edit the constants at the top. LANGUAGES lists each language by its tag, its own name and a one-sentence rule describing how it sorts. REGIONS lists each region with its first weekday (0 Sunday, 1 Monday, 6 Saturday), whether people there read a 12-hour clock and whether they measure distance in miles. PLACES are the names the sort cell orders, and SAVED is what the account has stored when the page opens: put the person's real settings there. Everything on the page is worked out from those, so nothing is typed twice.
How is the sort order decided?
By the browser's Intl.Collator for the chosen language, so the order is the one that language's readers expect and not a hand-written list. The rows sit in fixed slots, so when you change the language the names change in place rather than rows jumping around. The one-line rule under the list is typed text for each language, and "Åre is 3 of 8" is counted from the sorted list. A browser without locale data falls back to its default order, which still sorts but may not move the accented letters.
Where do the week and the units come from?
The first weekday, the clock and the distance unit are typed per region, in the style of the Unicode locale data, and picking a region resets the two unit selects to its usual choices. If you then pick something else, the cell says it is not the usual choice there. The month is fixed (October 2026) and always six rows, so its height never changes, and the weekday names and the two examples are printed by Intl.DateTimeFormat and Intl.NumberFormat in the chosen language and region, so decimal commas and 12-hour marks come out as they do for real users.
What happens when I press Save, and what stays local?
Nothing leaves the page. The block keeps the saved settings and the ones being edited, counts how many differ and says so in its status line ("2 changes not saved yet."). Save makes the edited copy the saved one and says it was saved in this demo; Discard puts the saved copy back. To make it real, send the language, region and unit choices to your API in the save handler and update the saved copy from the response. Save and Discard are marked aria-disabled rather than disabled while nothing changed, so they keep their place and focus, and pressing one says there is nothing to do.
Is it accessible?
The language, region and unit controls are native selects with visible labels, and the status line is a polite live region that is present from the start: after each choice it says what changed ("Sorted for Svenska: Åre is 3 of 8."). The month is a real table with a caption, abbreviated weekday headings that carry the full day name, and a screen-reader note on the first day of the week, today is marked with aria-current="date", and the sorted places are an ordered list. Every control works from the keyboard.
Where is the date, number and currency preview?
Not here. This panel shows only what a language and a region change in the place they live: the order of names, the first day of the week and the units. A table of sample dates, numbers and currencies belongs to the language and region dialog, which is a separate block, so a settings page can use both without repeating itself.
Related
- Pro
A team intranet's profile page with its language and region dialog shown open: a Language tab with a searchable list of eight languages, a Region tab with country, first day of the week and clock, and a live preview that reformats a sample date, time, number and amount with Intl.
- Pro
Timezone and Calendar Settings
Appearance and localeA working hours settings panel: seven bars, one per day, with start and end selects and an Open switch, a week start that turns the rows, a Copy Monday to weekdays button, and a time zone pair that turns the first open day into both zones.
- Pro
Localization Settings
Appearance and localeA localization settings panel: a table of languages with translation progress, a Default radio, an RTL tag and an On switch, languages to add in the same table, and a fallback chain with Move up and down whose sentence follows its order.
- Pro
Language Selector Footer
PreferencesA footer for a meeting-notes tool whose segmented control (EN, FR, DE, ES) rewrites the footer's own words, with three link groups and a legal row.
- Pro
Appearance Settings
Appearance and localeAn appearance settings panel that previews instead of applying: a drawn app window that wears the choices, theme and contrast cards with a drawn thumbnail each, a text-size slider with a sample sentence and a reduce motion switch with a replay.
- Pro
Brand Asset Settings
Appearance and localeA logo check panel: Paper and Ink tiles showing a drawn lettermark at true size with its clear space in hairlines and its contrast worked out from the hex values, a Full, Mark or Mono toggle, a size slider that warns below 24 px, and a four-colour palette with Copy.