Skip to content
Calm motion: animations on this site only fade, with no movement

LanguageSwitcher ​

Pick the language: a select or a list of links

Basic

Current: en

Links
  • Write each language name in the language itself, for example "Bahasa Indonesia", not "Indonesian". A reader looks for their own language, and may not read the current one.
  • Each name has its own lang, so a screen reader says it with the right voice.
  • With href, the switcher is a list of links, for a footer or a site that has one URL per language. The current language has aria-current, and each link has hreflang. Without href, it is a native <select>, and v-model gives the code.
  • The switcher does not change the page language itself. Load the words and set lang on <html> when v-model changes.

Usage ​

ts
import { BlessLanguageSwitcher } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
languages*BlessLanguage[]—
href((code: string) => string)—the page in each language: the switcher becomes a list of links, for a footer or a site that has a URL per language
labelsPartial<{ label: string; }>—
modelValuestring—the code of the current language

Events

NamePayloadDescription
update:modelValue[value: string | undefined]

Released under the MIT License. Character names and artwork belong to their owners.