Skip to content

Drop-down list - AvSelect

✨ Introduction

The AvSelect is a Vue component enabling a user to select an item from a given list.

The drop-down list provides a list of options from which the user can choose. Only the visible part of the component is stylized: the drop-down list of options retains the browser style.

🏗️ Structure

AvSelect consists of a set of <option> within a <select>.

🏷️ Props

NameTypeDefaultMandatoryDescription
modelValuestring | numberSelected option value.
requiredbooleanfalseIndicates if the select is required.
disabledbooleanfalseIndicated if the select is disabled.
options(string | undefined | { value: string | undefined, text: string disabled?: boolean})[][]Selectable options.
labelstring''Select text label.
namestring''Field name.
hintstring''Texte d'indice pour guider.
successMessagestring''If set, display a success message.
errorMessagestring''If set, display an error message.
placeholderstringPlaceholder text.
idstringselect-${crypto.randomUUID()}Unique id for the select. Used for the accessibility.
densebooleantrueDense mode for reduced padding.

🔊 Events

NameData (payload)Description
'update:modelValue'string | numberEmitted when an option 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
<template>
  <AvSelect
    v-model="select"
    :options="[
      { value: 1, text: 'Choice number 1' },
      { value: 2, text: '2' },
      { value: 3, text: '3' },
      { value: 4, text: '4' },
    ]"
    placeholder="Placeholder"
  />
</template>