Skip to content
HomeCobalt

Slider

Sets a number, or a low and a high bound, by its place along a scale, and lets the bounds of a range be typed exactly.

Examples

How close a name must be to count as a match, from 50 to 100 percent. The figure beside the label changes in place as the thumb moves, and the arrow keys step by 1.
Match threshold80%
Log scaleAssets under management from $1M to $1T on a log track, so each tenfold step takes the same room. Type 250M or 1.2B in either field to set a bound exactly; leave one empty for no limit.

Type an amount, such as 250M or 1.2B

Funds with $1B to $50B in assets

RangeFund age, from 0 to 40 years, on a linear track with two thumbs. Drag either thumb, or type a year in its field; a thumb dragged all the way out leaves its field empty, for no limit.

Type a number

VerticalZoom on a venue's photo, as a track standing along the photo's edge: up zooms in, the figure above the track says how far, and the arrow keys step by 10 percent.
The terrace of the venue, over the river
100%
In a filter barAssets as one more filter in a screener's row. Its pill reads Assets until a range is set, then the range in the ink fill every filter that is on takes; the list is filtered when a drag ends or a field is left. On a phone it sits in the Filters sheet with the rest, counted as one, and Clear stays beside the Filters pill.

3 funds

Usage

Use it when

  • A number whose place on a known scale matters more than its exact figure, such as how close a name must be to count as a match.
  • A range of numbers that people set roughly and sometimes exactly, such as a fund's assets or its age.
  • A numeric filter in a filter row over a list, as one more pill beside the others.

Use something else when

  • An exact number with no scale to place it on, such as a quantity. Use NumberField instead.
  • One of a few named settings, such as daily or weekly. Use SegmentedControl instead.
  • A filter over named choices, such as a fund's type. Use FilterBar instead.
  • A range of dates. Use DatePicker instead.

Rules

General

Content

Avoid

Limits

Install

npx shadcn@latest add https://kaanarici.com/r/cobalt/slider.json https://kaanarici.com/r/cobalt/range-filter.json https://kaanarici.com/r/cobalt/range.json
import { RangeField, rangeFieldLabels, Slider, sliderLabels, SliderValue } from "@/components/cobalt/ui/slider"
import { RangeFilter, rangeFilterLabels } from "@/components/cobalt/ui/range-filter"
import { describeRange, formatAmount, parseAmount, rangeWords, sameRange, type Bound, type Range } from "@/lib/cobalt/range"