0.1.5 • Published 7 months ago

gunjanwaveslider v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

GunjanWaveSlider

GunjanWaveSlider is a highly customizable Vue.js slider component designed to handle a wide range of use cases. Whether you're dealing with small or large ranges, this slider offers smooth, precise interactions and visually engaging animations. Built with reactivity and flexibility in mind, it can seamlessly integrate into any Vue.js project.


Features

  • Dynamic Range Handling: Handles both small and large ranges efficiently by dynamically determining the number of bars based on parent width.
  • Configurable Animations: Includes optional animations like smoke or flame effects for transitions.
  • Precision Sliding: Ensures every value in the range is accessible, even for large ranges.
  • Customizable Styles: Adjust bar height, width, gap, colors, handle size, and position.
  • Hover Feedback: Hand cursor appears when hovering over the slider.
  • Default Value Support: Set an initial value that reflects the slider's starting position.
  • Event-Driven: Emits the current value during sliding for real-time updates.

Installation

Install the package via npm:

npm install gunjanwaveslider

Usage

Basic Example

<template>
  <div>
    <GunjanWaveSlider
      :start="1"
      :end="100"
      :onSlide="handleSlide"
      :defaultValue="50"
      animationType="smoke"
      animationColor="#FFA500"
      :animationDuration="500"
    />
  </div>
</template>

<script setup>
import GunjanWaveSlider from 'gunjan-wave-slider';

const handleSlide = (value) => {
  console.log('Current Slider Value:', value);
};
</script>

Props

Required Props

PropTypeDescription
startNumberThe starting value of the range.
endNumberThe ending value of the range.
onSlideFunctionCallback function triggered on slide.

Optional Props

PropTypeDefaultDescription
defaultValueNumberstartInitial slider position.
barHeightNumber40Height of bars.
barWidthNumber2Width of bars.
barGapNumber2Gap between bars.
barActiveColorString#FFA500Color of active bars.
barInactiveColorString#566573Color of inactive bars.
handleWidthNumber7Width of the slider handle.
handleHeightNumber7Height of the slider handle.
handleColorString#F37529Color of the slider handle.
animationTypeStringsmokeType of animation (smoke or flame).
animationColorString#FFA500Color of the animation effect.
animationSizeNumber20Size of the animation effect.
animationDurationNumber500Duration of the animation (in ms).
showPopupBooleantrueWhether to show the value popup.
fontColorString#FFFFFFColor of the popup text.
fontSizeNumber14Font size of the popup text.
dropColorString#FF5733Background color of the popup.
handleSliderPositionStringcenterPosition of the slider handle (center, top, bottom).
showAnimationBooleantrueToggle for enabling/disabling animations.

Events

EventDescription
onSlideEmits the current slider value during interaction.

Example:

const handleSlide = (value) => {
  console.log('Slider Value:', value);
};

Customization

Here are a few examples of how you can customize the slider:

Example: Large Range with Animation

<GunjanWaveSlider
  :start="1"
  :end="5000"
  animationType="flame"
  animationColor="#FF4500"
  :animationDuration="700"
  :barHeight="50"
  :barWidth="3"
  :barGap="4"
/>

Example: Minimalist Design

<GunjanWaveSlider
  :start="0"
  :end="100"
  showPopup="false"
  :barHeight="30"
  :barWidth="1"
  barActiveColor="#4CAF50"
  barInactiveColor="#C8E6C9"
  handleColor="#4CAF50"
/>

CSS Customization

You can further customize the styles by overriding the default classes in your Vue project.

Example:

.slider-handle {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.slider-value {
  border-radius: 10px;
}

Development and Contribution

  1. Clone the repository:

    git clone https://github.com/gunjan1sharma/GunjanWaveSlider
  2. Install dependencies:

    npm install
  3. Start the development server:

    npm run serve
  4. Build the package:

    npm run build

Feel free to open issues and submit pull requests for improvements.


License

This project is licensed under the MIT License.


Author

Created with ❤️ by Gunjan Sharma From India. For queries or suggestions, reach out at gunjan.sharmo@gmail.com.


Happy Sliding! 🚀

0.1.5

7 months ago

0.1.4

7 months ago

0.1.3

7 months ago

0.1.2

7 months ago

0.1.0

7 months ago