Socket
Socket
Sign inDemoInstall

vue-custom-range-slider

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue-custom-range-slider

Slider component for vue, with support for custom values


Version published
Weekly downloads
257
decreased by-15.18%
Maintainers
1
Install size
287 kB
Created
Weekly downloads
 

Readme

Source

vue-custom-range-slider

This is a simple vue-range slider, that supports custom values, labels and more. The component is based on use with v-model, the value is always a string, for supporting custom values.

Demo

See the slider in action, in this codesandbox

Installation

NPM

npm install --save vue-custom-range-slider

Yarn

yarn add vue-custom-range-slider

Usage examples

Usage like a native range slider

<template>
  <div>
    <custom-slider min="10" max="50" step="2" raising v-model="slider" />
    {{ slider }}
  </div>
</template>

<script>
  import CustomSlider from "vue-custom-range-slider";
  // import the styling, css or scss
  import "vue-custom-range-slider/dist/vue-custom-range-slider.css";

  export default {
    components: {
      CustomSlider
    },
    data() {
      return {
        slider: "12"
      };
    }
  };
</script>

Usage with custom values

<template>
  <div>
    <custom-slider :values="sliderValues" raising v-model="slider" />
    {{ slider }}
  </div>
</template>

<script>
  import CustomSlider from "vue-custom-range-slider";
  // import the styling, css or scss
  import "vue-custom-range-slider/dist/vue-custom-range-slider.css";

  export default {
    components: {
      CustomSlider
    },
    data() {
      return {
        slider: "a",
        sliderValues: [
          {
            label: "Not at all",
            value: "a"
          },
          {
            label: "A tiny bit",
            value: "b"
          },
          {
            label: "Its ok",
            value: "c"
          },
          {
            label: "Its very good",
            value: "d"
          },
          {
            label: "Its AMAZING!",
            value: "e"
          }
        ]
      };
    }
  };
</script>

Properties:

All properties are optional

PropertyDescriptionTypeDefault
valuesPass an array of custom values, with corresponding labels (overrides min/max)array[]
minSets the minimum value of the sliderstring'0'
maxSets the maximum value of the sliderstring'100'
stepSets the stepping intervalstring'1'
hideLabelSet, if you want to hide the label above the sliderbooleanfalse
raisingSet if you want a "raising" shape, like: ◁booleanfalse

Events

NameDescriptionType
changeEmits the current value on changestring

Styling

You can easily modify the look of the slider, by overriding the variables in the scss file.

// override variables like this:
$label-color: red;

// import the styling,
@import "vue-custom-range-slider/dist/vue-custom-range-slider.scss";

All variables can be found in the scss file

Roadmap

  • Disabled properties
  • Name attributes for form handling
  • Better styling options

Contribution

If you have suggestions for improvements, dont hesitate to make an issue or pull request. :)

License

MIT

Keywords

FAQs

Last updated on 13 Nov 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc