🎨
Valence
🎨
Valence
  • Overview
    • 👋Welcome to Valence
    • 🏄‍♂️Getting started
  • Core Concepts
    • Responsiveness
    • Color
      • List of colors
      • Color types
    • Polymorphism
  • Valence Core
    • 🏃‍♂️Fundamentals
      • 🎬The ValenceProvider
      • ✍️Using custom fonts
    • 🧱Components
      • 🔘Buttons
        • Button with icon
        • Grid Button
        • Text button
        • Icon button
        • Multi-part button
        • Unstyled button
        • Primitive button
      • ⌨️Inputs
        • Color Picker
        • Text input
        • Text area
        • Number input
        • Select input
        • Switch
        • Slider
        • Range slider
        • Pill selector
        • Input container
        • Dropdown container
      • 🖥️Display
        • Accordion
        • Alert
        • Color Swatch
        • Icon
        • Image
        • Avatar
        • Avatar Group
        • Loader
        • Pill
        • Spoiler
        • Stepper
        • Text
        • Title
      • 🧩Layout
        • App Container
        • Card
        • Flex
          • Flex Center
          • Styled Flex
        • Floating Toolbar
        • Grid
        • Header
        • Overflow Container
        • Space
      • 🗺️Navigation
        • App Nav
      • 🔼Overlays
        • Modal
        • Tooltip
        • Modal background
        • 📰Sheets
          • Bottom Sheet
          • Dynamic Sheet
          • Side Sheet
    • 🪝Hooks
      • UseColorScheme
      • UseColors
      • UseControlledList
      • UseDetectKeyDown
      • UseDisclosure
      • UseFloating
      • UseTooltip
      • UseBreakpoint
      • UseResponsiveProps
    • 🤚Generics
      • Generic button props
      • Generic input props
      • Generic Sheet Props
  • Valence Plugins
    • 🎠Valence Carousel
      • Carousel Child Props
  • Valence Utils
    • ✋Generics
      • Clickable
      • Events
      • Global
      • Grid
      • Layout
      • Overlay
      • Polymorphic
    • 🧜‍♀️Polymorphism
      • Polymorphic Button
      • Polymorphic Layout
      • Polymorphic Text
  • Update Notes
    • 3.0.0
    • 2.7.0
    • 2.6.0
    • 2.5.0
    • 2.4.0
    • 2.3.0
    • 2.2.0
    • 2.1.0
    • 2.0.0
Powered by GitBook
On this page
  • Usage
  • Minimum distance & pearling
  • Other modifications
  • Props

Was this helpful?

Edit on GitHub
  1. Valence Core
  2. Components
  3. Inputs

Range slider

Last updated: 2.0.0 (18/01/2024)

PreviousSliderNextPill selector

Last updated 1 year ago

Was this helpful?

The Range slider is an expansion of the single-handle component. This component can simultaneously support a virtually limitless number of handles.

Usage

import { RangeSlider } from "@valence-ui/core";

function MyComponent() { 
    const [value, setValue] = React.useState([25, 50, 75]);

    return ( 
        <RangeSlider 
            value={value}
            setValue={setValue}
        />
    )
}

The number of values handled (and therefore handles displayed) is determined by the number of initial values passed to the useState.

Minimum distance & pearling

You can stop one thumb from pushing its peers when they collide by using the pearling prop. Additionally, the minDistance prop controls the minimum distance that two thumbs can become. If pearling=true, the thumbs will begin pushing one another around once they reach the minDistance from one another.

import { RangeSlider } from "@valence-ui/core";

function MyComponent() { 
    const [value, setValue] = React.useState([25, 50, 75]);

    return ( 
        <RangeSlider 
            value={value}
            setValue={setValue}
            
            pearling={false}
            minDistance={10}
        />
    )
}

Other modifications

Other modifications can be made to the Range slider using the same props as the regular Slider.


Props

Property
Type
Description

min

number

The minimum value of this input. 0 by default.

max

number

The maximum value of this input. 100 by default.

step

number

The step value of this input. 1 by default.

minDistance

number

The minimum distance between the two thumbs. 0 by default.

pearling

boolean

Whether the active thumb will push other thumbs. true by default.

showValue

boolean

Whether to show this slider's value on the thumb. false by default.

invert

boolean

Whether to invert the direction of the slider. false by default.

includeManualInput

boolean

Whether to include a manual input with this slider. true by default.

manualInputPosition

"left" | "right"

The position of this manual input, if shown. "right" by default.

trackProps

Optional props to pass to track components.

thumbProps

Optional props to pass to thumb components.

Extends and .

Omit<, "state">

Omit<, "state">

🧱
⌨️
Slider
See the Slider reference.
GenericInputProps<number[]>
SliderEventProps<number[]>
SliderTrackProps
SliderThumbProps