Skip to content

Header - AvHeader

✨ Introduction

The AvHeader component is an ultra-flexible header component. It integrates a search bar and quick links. 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.
  • the service name.
  • 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.
serviceTitlestringundefinedTitle of the service displayed in the header.
homeTostring | RouteLocationRaw'/'Homepage link.
modelValuestring''Value for the search bar.
placeholderstring'Rechercher...'Placeholder for the search bar.
quickLinksAvHeaderMenuLinksProps['links'][]Quick links to display in the header.
languageSelectorAvLanguageSelectorPropsundefinedQuick links to display in the header.
searchLabelstring'Recherche'Label for the search bar.
quickLinksAriaLabelstring'Menu secondaire'ARIA label for quick links.
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 | | before-quick-links | Slot to add content before quick links. | | after-quick-links | Slot to add content after quick links. | | mainnav | Slot for the main navigation menu. | | serviceDescription | Slot for the description of the service. | | 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"
    service-title="Student Cofolio"
    home-to="/student"
    show-search
    :language-selector="languageSelector"
    @language-select="selectLanguage($event)"
  >
    <template #before-quick-links>
      <ul class="fr-btns-group">
        <li>
          <StudentMailboxPopover />
        </li>
        <li>
          <StudentNotificationsPopover />
        </li>
        <li>
          <StudentProfilePopover />
        </li>
      </ul>
    </template>
    <template #mainnav>
      <StudentNavigation />
    </template>
  </AvHeader>
</template>