Fader
A vertical control with optional tick marks.
Use Fader for level-style parameters. Its drag is relative to where it started.
import { Fader } from '@soundor/components';
import { parameters } from 'soundor:parameters';
export default function Demo() {
return (
<Fader parameter={parameters.gain} ticks={[-24, -12, 0, 6]} length={150} />
);
}fader.tsx, running in the web runtime.SourceUsage
With a parameter
Pass a generated parameter and the control inherits its range, mapping, formatting, parser and reset value. It opens and closes host gestures and records undo history; set history={false} to opt out, or history={{ label: 'Adjust feedback' }} to name the entry.
<Fader parameter={parameters.gain} ticks={[-24, -12, 0, 6]} length={160} />Without a parameter
Pass value and onChange (or defaultValue) with the range you need. A controlled control should update value in response to onChange.
const [gain, setGain] = useState(0);
<Fader
label="Gain"
min={-24}
max={6}
value={gain}
onChange={setGain}
ticks={[-24, -12, 0, 6]}
/>;Keyboard and accessibility
← → ↑ ↓ change the value by 1% of the range, Page Up and Page Down by 10%, and Home and End go to the minimum and maximum. Shift makes any of them ten times finer, in drag and wheel too. Double-click or Alt-click (Option-click on a Mac) resets the value, as do Delete and Backspace, and Esc cancels a drag. A screen reader hears the label and formatted value, and can increment, decrement, set or reset it. See Keyboard and accessibility.
Props
See Mixed values for editing multiple items.
Fader props
Prop
Type
Range props
Prop
Type