VelocityUI logoVelocityUI

Slider

Range input with a custom track and thumb. Supports a label, live value readout, min/max/step configuration, and disabled state.

Import

tsx
import { Slider } from '@velocityuikit/velocityui'

Preview

With label and value

40

Custom range and step

100

Sizes

Disabled

Props

PropTypeDefaultDescription
valuenumberControlled value.
onChange(value: number) => voidCallback fired when the value changes.
minnumber0Minimum value.
maxnumber100Maximum value.
stepnumber1Step increment.
labelstringLabel displayed above the slider.
showValuebooleanfalseShows the current numeric value to the right of the label.
size'sm' | 'md' | 'lg''md'Height of the track area.
disabledbooleanfalseDisables interaction.

Examples

Basic

tsx
import { Slider } from '@velocityuikit/velocityui'
import { useState } from 'react'

export default function Example() {
  const [val, setVal] = useState(40)
  return <Slider value={val} onChange={setVal} label="Volume" showValue />
}

Stepped

tsx
import { Slider } from '@velocityuikit/velocityui'
import { useState } from 'react'

export default function Example() {
  const [val, setVal] = useState(50)
  return <Slider value={val} onChange={setVal} min={0} max={200} step={25} label="Budget" showValue />
}

Theming

Apply a named theme class to <body> or any parent element. All VelocityUI components inside that element will automatically adopt its colors, shadows, and effects. Combine with a density modifier for complete control:

css
/* Pick any named theme */
<body class="vui-theme-ocean">

/* Add a density modifier (optional) */
<body class="vui-theme-midnight vui-density-compact">
<body class="vui-theme-construction vui-density-spacious">

/* Available themes */
/* default  midnight  ocean  tangerine */
/* construction  glass  soft  high-contrast  monochrome-red */

/* Available densities */
/* vui-density-compact  vui-density-comfortable  vui-density-spacious */