Mục lục tham khảo

Thành phần thương hiệu

Language switch

EN · VI switch; the current locale in ink 700, the other a real link that keeps the hash and ?mode. No flags.

Nội dung tham khảo viết bằng tiếng Anh; mục “Vietnamese” có ví dụ tiếng Việt.

Xem trước

ENVI

Install

bash

npx shadcn add @eloquent/language-switch

Usage

tsx

import { LanguageSwitch } from "@/components/ui/language-switch";

<LanguageSwitch locale="en" label="Language" hrefFor={(locale) => `/${locale}/work`} />

States

ENVI
ENVI
ENVI
StateTreatment
CurrentInk, Barlow 700, aria-current="true", not a link
OtherHalftone, a real link to the same page in that locale; keeps the hash and ?mode
Focus-visible2px ink outline with a 2px offset
divider={false}No hairline on the left

Keyboard

KeyAction
TabMoves to the other locale's link (the current one is not a link)
EnterOpens the same page in that locale

Vietnamese

ENVI

Ink adaptation

Brand item with no upstream. No flags and no colour: weight and ink against halftone mark the current edition. hrefFor runs where the switch renders (server-safe); a small client link adds the current hash and ?mode after hydration.