Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/jonathandn/vue-dropdown

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/jonathandn/vue-dropdown

  • v0.0.0-20201011053916-2a231eb34dc7
  • Source
  • Go
  • Socket score

Version published
Created
Source

vue-dynamic-dropdown

A Highly Customizable, easy-to-use, elegant, dropdown component

Feedback would be much appreciated, questions, suggestions, issues are more than welcome.

MIT License view on npm

Demo

A dropdown demo gif

Edit Vue Dynamic Dropdown Component

Usage:

First

Install via NPM npm i vue-dynamic-dropdown

Second

Require in your project:

var VueDropdown = require('vue-dynamic-dropdown');

or ES6 syntax:

import VueDropdown from 'vue-dynamic-dropdown'

Third

You can register the component globally:

Vue.component('vue-dropdown', VueDropdown);

Or locally in a single Vue component:

components: {
  VueDropdown
}

Insert the following selector anywhere in your project (global) or in your existing component (local): NOTE: To get up and running quickly the package now supports rendering just the selector with default values.

<vue-dropdown></vue-dropdown>

Docs:

config: {...} is a configuration object that is to be bound to vue-dropdown, API properties are:

Basics

PropertyTypeDescription
optionsarrayHolds the inner selection options of the dropdown (shown when open), each single option is an object that has the value key that pairs with the given value e.g { value: '1st Option' }
widthnumberDetermines the width of the dropdown button & options drawer
placeholderstringThe text shown on the dropdown button by default
prefixstringA text prefix that will be added before the placeholder text
disabledbooleanSet true if the dropdown should be disabled

Customized Styling

PropertyTypeDescription
backgroundColorstringSet the dropdown button & options area background color
hoverBackgroundColorstringSet the dropdown button & options hover background color
borderstringSet the dropdown button & options border
textColorstringSet the dropdown button & options text color
disabledBackgroundColorstringSet the disabled dropdown button background color
disabledTextColorstringSet the disabled dropdown button text color

Events

Event NameReturnsDescription
setSelectedOptionOption ObjectClicking a dropdown option emits an option data object upwards

Listening to the event e.g:

<vue-dropdown @setSelectedOption="myLocalSetterFunction($event)"></vue-dropdown>

Implementation Example

Define your config options object in the component importing VueDropdown e.g

data: function() {
    return {
        config: {
            options: [
                {
                    value: "option 1"
                },
                {
                    value: "option 2"
                },
                {
                    value: "option 3"
                },
            ],
            prefix: "The",
            backgroundColor: "green", 
            disabled: false,
        }
    }
}

And bind it to the selector like so

<vue-dropdown :config="config"></vue-dropdown>


👨‍💻 Follow me on Twitter.

Donation

If this project helped you reduce development time, you can buy me a cup of coffee :)

FAQs

Package last updated on 11 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc