Skip to content

Slider

The Slider component lets people pick a single value or a range by dragging thumbs along a track. It’s built on Radix UI Slider with a label, an optional live value, and description or min/max captions.

Variations

Severity slider

SeveritySlider is a specialized variant with a gradient track and two thumbs for defining severity thresholds.

Installation

import { Slider, SeveritySlider } from '@harnessio/ui/components'
// Pipeline timeout with tooltip
<Slider
label="Pipeline timeout"
description="Maximum execution time in minutes"
showValue
defaultValue={[30]}
min={5}
max={120}
step={5}
formatValue={(v) => v[0] + 'm'}
onValueChange={(value) => console.log(value)}
/>
// Resource allocation range
<Slider
label="CPU allocation"
description="Min and max cores for build containers"
showValue
defaultValue={[2, 8]}
min={1}
max={16}
/>
// Deployment rollout with min-max labels
<Slider
label="Deployment rollout"
caption="min-max"
minLabel="0%"
maxLabel="100%"
defaultValue={[25]}
/>
// Alert severity thresholds
<SeveritySlider
label="Alert thresholds"
defaultValue={[25, 75]}
onValueChange={(value) => console.log(value)}
/>