Skip to content

Range Window

Two machined handles define a highlighted interval on a recessed track.

LIVE PREVIEWInteract with the component
Just React. No extra dependencies.

Copy the component and its CSS module into your project.

CSS Modules

Usage

Matches your current playground settings.

jsx
import RangeWindow from "./RangeWindow";
export default function Example() {
return (
<RangeWindow
defaultValue={[
25,
75
]}
min={0}
max={100}
step={1}
label={"Exposure window"}
lowerLabel={"Minimum exposure"}
upperLabel={"Maximum exposure"}
color={"#c6abd7"}
disabled={false}
/>
);
}

Using Range Window

Use value and onValueChange for a controlled interval, or defaultValue for local state. The handles cannot cross and both remain reachable with the Tab key.

Set min, max and step for your measurement. Use formatValue for units and name to submit the values as name[min] and name[max] fields.

Props

NameTypeRequiredDefaultDescription
value[number, number]NoundefinedControlled lower and upper values.
defaultValue[number, number]No[25, 75]Initial uncontrolled interval.
onValueChangefunctionNoundefinedReceives the next lower and upper values.
minnumberNo0Minimum permitted value.
maxnumberNo100Maximum permitted value.
stepnumberNo1Native range step size.
labelstringNo"Range"Visible and accessible group label.
lowerLabelstringNo"Minimum"Accessible lower-handle label.
upperLabelstringNo"Maximum"Accessible upper-handle label.
colorstringNo"#c6abd7"Handle, interval and focus colour.
disabledbooleanNofalseDisable both range inputs.
formatValuefunctionNoundefinedFormats visible values and accessible value text.
namestringNoundefinedOptional base name for hidden min and max form fields.
classNamestringNo""Additional classes on the root element.
styleCSSPropertiesNoundefinedInline styles for sizing, typography and appearance.

Related components

A recessed password field pairs a reveal control with an optional strength indicator.

Editable tags collect inside a softly framed input with individual remove controls.

A recessed search field expands into a polished capsule as you type.

Faceted stars lift into selection with a small marker beneath the chosen rating.