Vue Component with Multi-Thumb Support for Range Selection

vue-range-multi(WIP)

A range vue component that support one or more thumb

  • ✨ Support for one or more thumbs.
  • 🔄 Auto-detect the type of model and display the corresponding thumb(s).
  • 🔀 Automatically sort the model values without sorting the DOM.
  • ➕ Ability to add or remove thumbs dynamically.
  • 🚫 Avoid duplicate thumbs by rejecting them.
  • 🏃 Smooth movement or jump movement over the stops.
  • 🎨 Customizable style and theme.
  • 📝 Render content above or below the thumb.

Demo

Demo

Quick Start

  1. Install
pnpm add vue-range-multi
  1. Use in Vue
<script setup lang="ts">
import { ref } from 'vue'
import { Range } from 'vue-range-multi'

const model = ref<number>(0)
</script>

<template>
  <Range
    v-model="model"
  />
</template>

Props

generic=”T”

NameTypeDescriptionDefaultRequiredv-model:modelValuenumber | number[] | RangeData<T>[]model value. It will auto detect the type of model and show different thumb(s)[]trueminnumberminimum value0maxnumbermaximum value100stepnumberstep1addablebooleancan add data. This will emit ‘addThumb’falselimitnumberthe limit can be addundefinedsmoothbooleanwith smooth off, the thumb will only show on the stop pointfalsededuplicatebooleancan the thumb be duplicatedtruerangeHighlightbooleanhighlight range between min and max. This will only effect while modelValue is array and length is 2falseshowStopsboolean | numberwhether to show dots on the track. When set to number, will only show dots while stops less than the value12size‘small’ | ‘medium’ | ‘large’track size‘small’thumbType‘circle’ | ‘square’ | ‘rect’thumb type(default ‘rect’ while size is ‘large’, otherwise ‘small’)‘circle’ | ‘rect’thumbSize‘small’ | ‘medium’ | ‘large’thumb size‘medium’renderTop(data: RangeData<T>) => VNoderender function on the top of thumbundefinedrenderTopOnActivebooleanonly render top function on the active thumbfalserenderBottom(data: RangeData<T>) => VNoderender bottom function on the bottom of thumbundefinedrenderBottomOnActivebooleanonly render bottom function on the active thumbfalse

events

NameTypeDescriptionadd(value: number): voidadd event while click the track

types

export type RangeRenderFn<T = unknown> = (data: RangeData<T>) => VNode
export interface RangeData<T = unknown> {
  value: number
  data?: T
  disabled?: boolean
  renderTop?: RangeRenderFn<T>
  renderBottom?: RangeRenderFn<T>
}
export type RangeValue<T = unknown> = number | number[] | RangeData<T>[]

License

MIT License © 2023-PRESENT wiidede

GitHub

View Github

Related Posts

Recent Posts

ഇടുക്കിയിലെ മലയോര മേഖലകളിൽ രാത്രിയാത്ര നിരോധിച്ചു. രാത്രി ഏഴു മുതൽ രാവിലെ ആറു വരെയാണ് നിരോധനം

ഏന്തയാർ ഈസ്റ്റിൽ പ്രളയത്തിൽ തകർന്ന പാലത്തിന് പകരം പുതിയ പാലം നിർമ്മിക്കുവാൻ താത്ക്കാലിക പാലം പൊളിച്ച് നീക്കി

Explore the Investment Opportunities: A Comprehensive Guide to Different Types of Mutual Funds

Title: Understanding Mutual Funds: A Beginner's Guide to Investing

തീവ്രമഴ മുന്നറിയിപ്പിന്റെ പശ്ചാതലത്തിൽ സംസ്ഥാനം ജാഗ്രതയിൽ

250,000 അപേക്ഷകൾ വർദ്ധിച്ചതിനാൽ ട്രാൻസ്‌പോർട്ട് കമ്മീഷണർ പരിശോധന പുനരാരംഭിക്കും

ഏലക്കയിൽ കീടനാശിനി സാന്നിധ്യം; ആറര ലക്ഷത്തിലധികം ടിൻ അരവണ നശിപ്പിക്കാൻ ടെൻഡർ ക്ഷണിച്ച് ദേവസ്വം ബോർഡ്‌

ഭീമൻ പാറക്കഷണങ്ങൾ അടർന്ന് ദേശീയ പാതയിലേക്ക് വീഴുന്നത് പതിവാകുന്നു. കുട്ടിക്കാനത്തിനും മുണ്ടക്കയത്തിനുമിടയിൽ നിലനിൽക്കുന്നത് വൻ അപകട ഭീഷണി

ചക്രവാതച്ചുഴി:അതിശക്തമായ മഴ വരുന്നു

പ്ലസ് വൺ പ്രവേശനം. അക്ഷയയിൽ തിക്കി തിരക്കേണ്ട, നെറ്റിവിറ്റി/ജാതി തെളിയിക്കാൻ പത്താംതരം സർട്ടിഫിക്കറ്റ് മതി