A split ratio slider with two color bars, a draggable divider, and responsive labels that collapse when space is tight.
Dependencies
Interaction Type
Hover for micro-clicks; drag the divider or press track for real-time tick sounds. Use arrow keys to adjust the ratio.
Props
Options you can pass to customize this component.
valueControlled ratio value (0-100).
defaultValueInitial ratio for uncontrolled usage. Defaults to 60.
onChangeCalled with the new ratio on each change.
leftLabelLabel for the left side. Defaults to "RICH".
rightLabelLabel for the right side. Defaults to "LIGHT".
leftColorBackground color of the left bar.
rightColorBackground color of the right bar.
disabledDisables all interactions.
classNameAdditional CSS classes.
Installation
How to use
import { RatioSlider } from "@/components/ui/ratio-slider"
export function Demo() {
return (
<RatioSlider
defaultValue={60}
leftLabel="RICH"
rightLabel="LIGHT"
leftColor="var(--color-fg)"
rightColor="var(--color-muted)"
/>
)
}Source Code
Click the code icon in the top-right corner to view the source code.
License & Usage
// No code loaded.