Slider

Picks a number, or a range, by dragging or with the arrow keys; Page Up and Page Down take big steps, Home and End go to the ends. Built on ui-sdk's Slider. Pair it with SliderValue or a field so the number can be read.

BetaReady to use. Its API can still change in a minor release; the changelog says when.

import { Slider, SliderValue } from "@leap-crm/design-system";

Playground

Change a prop and the component follows. Its code is under Props.

60

Props

min
max
step
disabled

Best practices

When to use it, and the rules that apply in particular places.

GuidancePractice
DoPair it with SliderValue or a field, so the number can be read, like a 60% probability on an opportunity.
DoName it with aria-label or a Label. For a range, name each thumb with thumbLabels, like Minimum and Maximum.
DoSave in onValueCommit, which runs when the drag ends, rather than on every step of onValueChange.
Don'tUse it for an exact figure, like a fee estimate or a matter number. Use Input: typing an exact value is faster than dragging to it.

Props

Slider also takes ui-sdk's value, defaultValue, onValueChange, onValueCommit, min, max, step, largeStep, minStepsBetweenThumbs, orientation, disabled, readOnly, name, format and locale.

Slider

PropTypeDefaultDescription
childrenReactNode—Shown after the track, like a SliderValue readout.
thumbLabelsstring[]—Names each thumb for screen readers when there's more than one, like ["Minimum", "Maximum"].
classNamestring—Classes added to the root element, merged with its own. Tokens only.

SliderValue

PropTypeDefaultDescription
classNamestring—Classes added to the root element, merged with its own. Tokens only.

Code

What the playground shows, ready to copy.

import { Slider, SliderValue } from "@leap-crm/design-system";

<Slider defaultValue={60} aria-label="Probability" min={0} max={100} step={5}>
  <SliderValue />
</Slider>

Range

Two thumbs pick a range; name each one with thumbLabels.

A$2,000 – A$8,000

Keyboard

The keys it answers to. Tab moves between components, arrows move within them.

KeysWhat they do
ArrowRightArrowUpIncrease it by one step.
ArrowLeftArrowDownDecrease it by one step.
Page UpPage DownMove by the large step, as Shift with an arrow key does.
HomeEndGo to the minimum and the maximum.
TabMoves through the thumbs in order.