Components
Components
Browse the controls, overlays, displays, and layout components.
Import styled components from @soundor/components. Each component page includes usage and API details. See Headless hooks if you want to draw your own controls.
| Use case | Components |
|---|---|
| Actions and choices | Button, Toggle, SegmentedControl, Select, SelectableList |
| Overlays | DropdownMenu, ContextMenu, Popover, Tooltip |
| Parameter and text editing | Knob, Slider, Fader, ValueField, TextField |
| Displays and graph editors | LevelMeter, Plot, Spectrogram, FrequencyKeyboard, XYPad, EnvelopeEditor |
| Layout and sizing | Panel, ControlGroup, Divider, ResizeGrip |
See how the components fit together in the interactive equalizer reference.
Mixed values
Set mixed on ValueField, Knob, Slider, Fader, Toggle, SegmentedControl or Select when the items being edited disagree. The control stays editable but shows no selected value. Use mixedLabel to replace “Mixed” wherever the control displays value text.
- Numeric controls: The first drag or arrow key starts from
mixedStart, or the parameter default,defaultValue, or minimum in that order.ValueFieldalso starts text entry there. Home and End keep their usual bindings. - Choices: Pick any segment or option, including one matching the underlying
value. A mixedToggleappliestrue, orfalsewithmixedPress="off".
The edit uses the usual onChange and, if the control already supports it, onChangeStart. The app decides how to apply the value to its items and when to clear mixed.
import {
Fader,
Knob,
SegmentedControl,
Select,
Slider,
Toggle,
ValueField,
} from '@soundor/components';
import { textStyle, useTheme } from '@soundor/components/theme';
import { Text, View } from '@soundor/react';
import { useState, type ReactNode } from 'react';
type ExampleProps<T> = {
value: T;
mixed: boolean;
onChange: (value: T) => void;
};
function Example<T>({
initial,
mixed: initiallyMixed,
children,
}: {
initial: T;
mixed: boolean;
children: (props: ExampleProps<T>) => ReactNode;
}) {
const [value, setValue] = useState(initial);
const [mixed, setMixed] = useState(initiallyMixed);
return (
<View style={{ flex: 1 }}>
{children({
value,
mixed,
onChange(next) {
setValue(next);
setMixed(false);
},
})}
</View>
);
}
function Pair<T>({
initial,
children,
}: {
initial: T;
children: (props: ExampleProps<T>) => ReactNode;
}) {
const theme = useTheme();
return (
<View style={{ flexDirection: 'row', gap: theme.spacing.spaceLg }}>
<Example initial={initial} mixed={false}>
{children}
</Example>
<Example initial={initial} mixed>
{children}
</Example>
</View>
);
}
const options = [
{ value: 'bell', label: 'Bell' },
{ value: 'shelf', label: 'Shelf' },
];
export default function Demo() {
const theme = useTheme();
const heading = textStyle(theme, 'technical');
const numeric = { max: 100, defaultValue: 25 };
return (
<View style={{ gap: theme.spacing.spaceLg, width: 360, maxWidth: '100%' }}>
<View style={{ flexDirection: 'row', gap: theme.spacing.spaceLg }}>
<Text style={{ ...heading, flex: 1 }}>Normal</Text>
<Text style={{ ...heading, flex: 1 }}>Mixed</Text>
</View>
<Pair initial={75}>
{(props) => <ValueField {...numeric} {...props} label="Value field" />}
</Pair>
<Pair initial={75}>
{(props) => <Knob {...numeric} {...props} label="Knob" />}
</Pair>
<Pair initial={75}>
{(props) => <Slider {...numeric} {...props} label="Slider" />}
</Pair>
<Pair initial={75}>
{(props) => (
<Fader {...numeric} {...props} label="Fader" length={100} />
)}
</Pair>
<Pair initial={true}>
{(props) => <Toggle {...props} label="Button" />}
</Pair>
<Pair initial={true}>
{(props) => <Toggle {...props} label="Chip" variant="chip" />}
</Pair>
<Pair initial={true}>
{(props) => <Toggle {...props} label="Switch" variant="switch" />}
</Pair>
<Pair initial="bell">
{(props) => (
<SegmentedControl {...props} label="Shape" options={options} />
)}
</Pair>
<Pair initial="bell">
{(props) => (
<Select
{...props}
label="Filter type"
width={130}
options={options}
/>
)}
</Pair>
</View>
);
}mixed-values.tsx, running in the web runtime.Source