Fader
A mixing-desk channel fader with a scale and an LED meter.
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/fader.jsonUsage
import { Fader } from "@/components/ui/fader"
<Fader label="Vox" defaultValue={70} level={0.6} />Examples
Graphic EQ
Ticks with a null label print the line without a number. Controlled values let presets move every band at once.
Crossfader
orientation="horizontal" lays the strip on its side; the scale prints below and the meter, if any, above.
Sizes, colors and disabled
The meter's top segments stay amber and red whatever the color.
API reference
className and style go on the outer element, where a height (or a width when horizontal) sets the travel. The ref and every other span attribute go on the cap, which has role="slider".
| Prop | Type | Default |
|---|---|---|
value | numberControlled value. | None |
defaultValue | numberInitial value when uncontrolled, and where a double-click on the cap returns to. | min |
onValueChange | (value: number) => voidCalled on every change while dragging or pressing keys. | None |
onValueCommit | (value: number) => voidCalled once the cap is let go or a key is released. | None |
min | numberLowest value. | 0 |
max | numberHighest value. | 100 |
step | numberValues snap to multiples of step from min. | 1 |
orientation | "vertical"Direction of travel. Up and right increase the value. | "vertical" |
ticks | numberA count of evenly spaced marks, or exact marks. A null or empty label prints the line only; 0 hides the scale. | 11 |
level | numberSignal from 0 to 1. Shows an LED meter beside the track when set. | None |
label | ReactNodeEngraved legend under the strip. Names the slider unless aria-label is set. | None |
showValue | booleanPrints the formatted value under the label. | false |
formatValue | (value: number) => stringFormats the printed value and aria-valuetext. | None |
name | stringSubmits the value with a form through a hidden input. | None |
color | NeonColorPalette name or hex. Lights the cap's line and the meter's lower segments. | inherited |
size | "sm"Scales the cap, slot, scale and meter. | "md" |
disabled | booleanDarkens the line and meter, blocks input and removes the cap from the tab order. | false |
Accessibility
- The cap has role="slider" with aria-orientation, aria-valuemin, aria-valuemax, aria-valuenow, and aria-valuetext when formatValue is set.
- Arrow keys move by one step, Shift+Arrow and Page Up/Down by a tenth of the range, Home and End jump to the ends.
- Grabbing the cap never makes it jump; pressing the slot glides the cap there and keeps dragging. Hold Shift while dragging for fine control.
- The LED meter is decorative and hidden from screen readers. Announce levels elsewhere if they matter.