Home Examples Charts Dashboard Projects Menu

Vue.js examples
Learn Vue.js

vuejs dropdown

Related course:
Fullstack Vue: The Complete Guide to Vue.js

You can connect a dropbox to a Vue array.

This makes it dynamic: if all of the data comes from JavaScript you could either fetch it using an Ajax request or define it in the array. But the good thing is you don’t have to think about the template if you want to change the data.

vuejs dropdown example

The example below creates a dropdown box that fetches the array from the Vue app.


In your app define the select input thats linked to the array.

<div id="app">
<select v-for="color in colors"
<option v-for="option in color.options" :value="option">



Inside your Vue instance you define your array. To keep a clear overview of your app, you could define it outside of your Vue instance.


const colors = [
options:["red", "yellow", "green"],
selectedOption: "yellow"

new Vue({

← vuejs class Examples →


© vuejsexamples.net - Privacy Policy - Cookie Policy