Skip to content

Balance Slider

A brass beam tilts as a weighted slider moves across its scale.

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 BalanceSlider from "./BalanceSlider";
export default function Example() {
return (
<BalanceSlider
defaultValue={65}
min={0}
max={100}
step={1}
label={"Balance"}
color={"#ddba80"}
showValue={true}
disabled={false}
/>
);
}

Using Balance Slider

Use min, max and step to define the range and onValueChange to receive updates. The native range input supports pointer dragging, touch and keyboard adjustments.

Pass value for controlled use or defaultValue for local state. Use formatValue to add a unit to the displayed value, and name to include the value in form submission.

Props

NameTypeRequiredDefaultDescription
valuenumberNoundefinedControlled numeric value.
defaultValuenumberNo50Initial uncontrolled value.
onValueChangefunctionNoundefinedReceives the numeric slider value.
minnumberNo0Minimum value.
maxnumberNo100Maximum value.
stepnumberNo1Native range input step size.
labelstringNo"Balance"Visible and accessible input label.
colorstringNo"#ddba80"Metal and slider colour.
disabledbooleanNofalseDisable the native range input.
showValuebooleanNotrueShow the current numeric value.
formatValuefunctionNoundefinedFormats the displayed value without changing the numeric input.
namestringNoundefinedForm field name.
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.