Slider

Slider is a neobrutalist React component from Cruise UI. Pick a value or a range by dragging: a 12px track, --primary range and square ink thumbs. Install it with npx shadcn@latest add @cruiseui/slider.

Install

Terminal

npx shadcn@latest add @cruiseui/slider

First time? Installation shows the one-off components.json setup (the @cruiseui registry) and how to turn the theme on.

Example

Corners
Price
₦5,000 – ₦25,000
Volume
60

When to use it

When to use

Approximate values in a range: a price filter, volume, distance.

When not to

Exact amounts (use a Naira input or an Input).

Props

CruiseSlider

PropTypeDefaultDescription
labelstring——
value?V——
defaultValue?V——
onValueChange?((value: V) => void)——
min?number0—
max?number100—
step?number1—
format?NumberFormatOptions—Number format for the value labels and screen readers, e.g. { style: "currency", currency: "NGN", maximumFractionDigits: 0 }.
showValue?booleantrueThe current value(s) next to the label.
showLimits?booleanfalseThe min and max under the track.
thumbLabels?[string, string]["Minimum", "Maximum"]Names for the two thumbs of a range, read after the label.
disabled?boolean——
className?string——

Accessibility

  • role="slider" thumbs with aria-valuenow and a formatted aria-valuetext (₦25,000).
  • Arrows, Page Up / Down, Home / End move the thumbs.
  • Each thumb of a range has its own name (Lowest / Highest price).