Skip to content

Language selector - AvLanguageSelector

✨ Introduction

The AvLanguageSelector allows users to choose the language in which the site content is displayed, if it is available in several languages. It takes the form of a button that opens a drop-down list.

🏗️ Structure

The language selector is composed by:

  • a button that opens or closes a drop-down menu of languages
  • a drop-down menu of available languages

🏷️ Props

NameTypeDefaultMandatoryDescription
idstringlanguage-selector-${crypto.randomUUID()}Unique id for accessibility.
languagesAvLanguageSelectorElement[]Available languages list. Each language is represented by an object containing a codeIso and a label.
currentLanguagestring'fr'ISO code of the current selected language.
titlestring'Sélectionner une langue'Title attribute for accessibility.

🔊 Events

NameData (payload)Description
selectAvLanguageSelectorElementEvent triggered when the a language is selected

🎨 Slots

None.

🚀 Storybook demos

You can find examples of use and demo of the component on its dedicated Storybook page.

💡 Examples of use

vue
<script>
const state = ref(false)
</script>

<template>
  <AvLanguageSelector
    v-bind="languageSelectorRef"
    @select="emit('languageSelect', $event)"
  />
</template>