Slider

A ticked track with a cut thumb and a value readout, single or range.

Component

Slider belongs to the Choices group in the CyberSpec catalog. It uses @ui-sdk/react/slider, @ui-sdk/react/field.

Installation

Use a React 19 project with shadcn configured. Render the installed components inside the Cyber root, and import your global stylesheet in the app entry point.

bunx --bun shadcn@latest add https://www.cyberspec.dev/r/slider.json

Example

"use client"

import { Slider } from "@/components/ui/slider"

export default function SliderDemo() {
  return (
    <>
      <Slider label="Gain" defaultValue={62} />
      <Slider label="Band" defaultValue={[240, 720]} min={0} max={1000} step={10} thumbLabels={["Band floor", "Band ceiling"]} format={(hz) => `${hz} Hz`} />
      <Slider label="Uplink power" defaultValue={35} hint="Held by the relay while the link is down." disabled />
    </>
  )
}

Install this example

bunx --bun shadcn@latest add https://www.cyberspec.dev/r/slider-demo.json

Resources

View as Markdown