Vue 3 Select Component can be installed using your favorite package manager:
npmpnpmyarnbun
sh$ npm add vue3-select-component
sh
$ pnpm add vue3-select-component
sh
$ yarn add vue3-select-component
sh
$ bun add vue3-select-component
TIP
Vue.js 3.5+ is required to use this component.
Single select usage Import the component with the styling, and use it in your Vue 3 application:
vue<script setup lang="ts">
import { ref } from "vue";
import VueSelect from "vue3-select-component";
const selected = ref("");
</script>
<template>
<VueSelect
v-model="selected"
:options="[
{ label: 'Option #1', value: 'option_1' },
{ label: 'Option #2', value: 'option_2' },
{ label: 'Option #3', value: 'option_3' },
]"
placeholder="Select an option"
/>
</template>
Since the component is built with TypeScript, your IDE will provide you with autocompletion and type checking automatically.
Multiselect usage Import the component with the styling, and use it in your Vue 3 application.
To enable the multiselect feature, all you need to do is:
is-multi
prop to true
v-model
<script setup>
import { ref } from "vue";
import VueSelect from "vue3-select-component";
const selected = ref([]);
</script>
<VueSelect
v-model="selected"
:is-multi="true"
:options="[
{ label: 'Option #1', value: 'option_1' },
{ label: 'Option #2', value: 'option_2' },
{ label: 'Option #3', value: 'option_3' },
]"
/>
Data binding
Vue 3 Select Component takes advantage of Vue's v-model
, which means you can use it with v-model
to bind the selected value(s) to a variable.
This makes it easy to use the component anywhere in your application, while being reactive and easy to work with.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4