Skip to content

Header - AvHeader

✨ Introduction

The AvHeader component is an ultra-flexible header component. It integrates a search bar and quick links (via the quickLinks slot). It also allows the addition of a main navigation in the mainnav slot and a language selector via the language-selector prop.

🏗️ Structure

The header consists of:

  • the Cofolio brand block.
  • an optional role context (i.e., user role or context-specific information).
  • a baseline (description) below the site name.
  • an optional functional section - offering quick access and/or a search bar and/or a language selector - adapted to the specific needs of each site.

🏷️ Props

NameTypeDefaultMandatoryDescription
searchbarIdstring'searchbar-header'Value of the id attribute of the searchbar input.
homeTostring | RouteLocationRaw'/'Homepage link.
modelValuestring''Value for the search bar.
placeholderstring'Rechercher...'Placeholder for the search bar.
languageSelectorAvLanguageSelectorPropsundefinedLanguage selector configuration.
searchLabelstring'Recherche'Label for the search bar.
showSearchbooleanfalseShows or hides the search bar.
showSearchLabelstring'Recherche'Label for the button to display the search.
menuLabelstring'Menu'Menu label.
menuModalLabelstring'Menu'Menu label in modal mode.
closeMenuModalLabelstring'Fermer'Menu close button label in modal mode.
homeLabelstring'Accueil'Home label comprising the title of the link presenting the service.

🔊 Events

NameData (payload)Description
'update:modelValue'Content (string) of the search input fieldEmitted when the search bar is updated.
'search'Content (string) of the search input fieldEmitted when a search is performed.
'languageSelect'Content (AvLanguageSelectorElement) of the selected languageEmitted when the user changes the site language.

🎨 Slots

| Name | Description | | quickLinks | Slot to add quick links. | | mainnav | Slot for the main navigation menu. | | roleContext | Slot for the role context (i.e., user role or context-specific information). | | default | Default slot for additional content in the header. |

💡 Examples of use

vue
<script setup lang="ts">
const { languageSelector, selectLanguage } = useLanguageSwitcher()
const searchQuery = ref('')
</script>

<template>
  <AvHeader
    v-model="searchQuery"
    home-label="Student Cofolio"
    home-to="/student"
    show-search
    :language-selector="languageSelector"
    @language-select="selectLanguage($event)"
  >
    <template #quickLinks>
      <ul class="av-btns-group">
        <li>
          <StudentMailboxPopover />
        </li>
        <li>
          <StudentNotificationsPopover />
        </li>
        <li>
          <StudentProfilePopover />
        </li>
      </ul>
    </template>
    <template #mainnav>
      <StudentNavigation />
    </template>
  </AvHeader>
</template>