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 hasaria-current, and each link hashreflang. Withouthref, it is a native<select>, andv-modelgives the code. - The switcher does not change the page language itself. Load the words and set
langon<html>whenv-modelchanges.
Usage
ts
import { BlessLanguageSwitcher } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
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 |
labels | Partial<{ label: string; }> | — | |
modelValue | string | — | the code of the current language |
Events
| Name | Payload | Description |
|---|---|---|
update:modelValue | [value: string | undefined] |