Buttons
Language Picker Button
A language picker built on a real select: keyboard support, type-ahead and the native mobile list all come from the browser.
- button
- language
- select
- no-js
Preview
Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this in the header: https://vibeui.ru/c/button-056?lang=en
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
# Install and place "button-056" (Language Picker Button) from VibeUI
## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/button-056.json
Registry item: https://vibeui.ru/r/button-056.json
Installs to: components/vibeui/button-056.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.
Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.
## 2. What it is
A language picker built on a real select: keyboard support, type-ahead and the native mobile list all come from the browser.
A language switcher that looks like a button and works like a native select. That brings keyboard support, type-ahead, the system list on phones and a correct announcement of the chosen value for free. The globe and the chevron are pure CSS, and no JS is needed at all. Zero dependencies, one file.
## 3. How to use it
import { Button056 } from "@/components/vibeui/button-056"
<Button056 defaultValue="ru" onChange={switchLocale} label="Interface language" />
Read the installed file for the full prop list.
## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.
Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)
## 5. Keep exactly as installed
- the real <select> inside: a custom menu would have to relearn the keyboard, type-ahead and the mobile list
- the focus ring on the plate via :has(select:focus-visible) — otherwise it wraps only the narrow field
- pointer-events:none on the chevron: without it a click on the mark does not open the list
- the aria-label on the select: it has no visible label, and the globe is not one
- language names in their own languages — 'Deutsch', not 'German': native speakers scan for them
- appearance:none together with a full set of custom padding: without it the system arrow overlaps the chevron
## 6. You may change
- the switcher's name through the label prop, which becomes its aria-label
- the list of languages through the languages prop
- the selected language through the defaultValue prop
- the accent colour through the accent prop
- the onChange handler and the rest of the native select props: name, form, disabled
## 7. Rules
- Do not replace the select with a custom menu for looks: you lose the keyboard, type-ahead and the mobile list.
- Do not translate language names into the current interface language — someone looking for their own language does not read the current one.
- The component does not switch the locale: it only reports the choice through onChange.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.
## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.For developers
npx shadcn@latest add https://vibeui.ru/r/button-056.jsonhttps://vibeui.ru/r/button-056.jsonКомпонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-button-056-*. Серверный компонент, JS не нужен вовсе: внутри плашки стоит настоящий <select> с appearance:none, глобус и шеврон нарисованы CSS. Фокус приходит на select, а обводку рисует плашка через :has(select:focus-visible) — поэтому кольцо охватывает всю кнопку. Шеврон помечен pointer-events:none, чтобы клик по нему открывал список.
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
import type { ComponentPropsWithoutRef, CSSProperties } from "react"
export type Button056Language = { code: string; label: string }
export type Button056Props = Omit<
ComponentPropsWithoutRef<"select">,
"children"
> & {
label?: string
languages?: Button056Language[]
accent?: string
}
// Идея компонента: кнопка выбора языка, которой не нужен ни JS, ни слой меню.
// Внутри — настоящий select с appearance:none, растянутый по всей плашке.
// Отсюда бесплатно приходят клавиатура, поиск по первой букве и системный
// список на телефоне; кнопке остаётся нарисовать глобус, рамку и шеврон.
const STYLES = `
:where([data-vibeui-block="button-056"]){
--vibeui-button-056-surface:oklch(1 0 0);
--vibeui-button-056-border:oklch(0.88 0.006 265);
--vibeui-button-056-fg:oklch(0.26 0.02 265);
--vibeui-button-056-muted:oklch(0.56 0.014 265);
--vibeui-button-056-accent:oklch(0.52 0.15 275);
--vibeui-button-056-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="button-056"]{
position:relative;display:inline-flex;align-items:center;gap:0.5rem;box-sizing:border-box;
height:2.625rem;padding:0 0.75rem;border-radius:0.625rem;
border:1px solid var(--vibeui-button-056-border);
background:var(--vibeui-button-056-surface);color:var(--vibeui-button-056-fg);
font-family:var(--vibeui-button-056-font);font-size:0.875rem;font-weight:600;line-height:1;
transition:border-color .16s ease;
}
[data-vibeui-block="button-056"]:hover{border-color:var(--vibeui-button-056-accent)}
/* Фокус приходит на select, а обводку рисует плашка. */
[data-vibeui-block="button-056"]:has(select:focus-visible){
outline:2px solid var(--vibeui-button-056-accent);outline-offset:2px;
}
[data-vibeui-block="button-056"] select{
appearance:none;cursor:pointer;
border:0;background:transparent;color:inherit;
font:inherit;padding:0 1.25rem 0 0;margin:0;
outline:0;
}
[data-vibeui-block="button-056"] select:focus{outline:0}
/* Глобус: круг с двумя меридианами. */
[data-vibeui-block="button-056"] [data-part="globe"]{
position:relative;flex:none;width:1.0625rem;height:1.0625rem;
box-sizing:border-box;border:1.5px solid var(--vibeui-button-056-accent);border-radius:50%;
}
[data-vibeui-block="button-056"] [data-part="globe"]::before{
content:"";position:absolute;left:50%;top:-1.5px;bottom:-1.5px;width:0.5rem;
margin-left:-0.25rem;box-sizing:border-box;
border:1.5px solid var(--vibeui-button-056-accent);border-radius:50%;
}
[data-vibeui-block="button-056"] [data-part="globe"]::after{
content:"";position:absolute;left:-1.5px;right:-1.5px;top:50%;height:1.5px;
margin-top:-0.75px;background:var(--vibeui-button-056-accent);
}
[data-vibeui-block="button-056"] [data-part="chevron"]{
position:absolute;right:0.75rem;top:50%;width:0.4375rem;height:0.4375rem;
margin-top:-0.3125rem;box-sizing:border-box;pointer-events:none;
border:1.5px solid var(--vibeui-button-056-muted);border-left:0;border-top:0;
transform:rotate(45deg);
}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="button-056"]{transition:none!important}}
`
/**
* Кнопка выбора языка на настоящем select: клавиатура и мобильный список даром.
* Один файл, ноль зависимостей, собственная палитра.
*/
export function Button056({
label = "Язык интерфейса",
languages = [
{ code: "ru", label: "Русский" },
{ code: "en", label: "English" },
{ code: "de", label: "Deutsch" },
{ code: "fr", label: "Français" },
{ code: "es", label: "Español" },
],
defaultValue = "ru",
accent,
className,
style,
...props
}: Button056Props) {
const palette = {
...(accent ? { "--vibeui-button-056-accent": accent } : null),
...style,
} as CSSProperties
return (
<>
<style href="vibeui-button-056" precedence="medium">
{STYLES}
</style>
<div data-vibeui-block="button-056" className={className} style={palette}>
<span data-part="globe" aria-hidden="true" />
<select {...props} defaultValue={defaultValue} aria-label={label}>
{languages.map((language) => (
<option key={language.code} value={language.code}>
{language.label}
</option>
))}
</select>
<span data-part="chevron" aria-hidden="true" />
</div>
</>
)
}