1.0.1 • Published 4 years ago

vue-sticky-select v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

vue-sticky-select

showcase

Select component for VueJS, inspired by macOS native select UI element.

Install

npm i vue-sticky-select

Usage

Select with prefix icons

<sticky-select
  :options="options"
  v-model="selectedOptionIndex"
  placeholder="Select option"
/>
import StickySelect from "vue-sticky-select";

export default {
  name: "FooBar",
  components: {
    StickySelect,
  },
  data: () => ({
    selectedOptionIndex: null,
    options: [
      {
        prefix: () => import("@/SomeIcon"),
        text: "Banana",
      },
      {
        prefix: () => import("@/SomeIcon"),
        text: "Avocado",
      },
      {
        prefix: () => import("@/SomeIcon"),
        text: "Durian",
      },
    ],
  }),
};

Select with plain strings

<sticky-select
  :options="options"
  v-model="selectedOptionIndex"
  placeholder="Select option"
/>
import StickySelect from "vue-sticky-select";

export default {
  name: "FooBar",
  components: {
    StickySelect,
  },
  data: () => ({
    selectedOptionIndex: null,
    options: ["Banana", "Avocado", "Durian"],
  }),
};

Props

PropTypeRequiredDefaultDescription
optionsArraytrue[]List of options
selectedNumberfalsenullSelected option index number
placeholderStringfalse""Placeholder text when no selected index is provided
disabledBooleanfalsefalseDisable select
base-classStringfalse"sticky-select"Base CSS class

Events

NameArgumentsDescription
changeindexOn newly selected option
openNoneOn options opened
closeNoneOn options closed