Skip to content
Eskais UI

Forms

Mixer

A mixing desk that splits a total between channels: moving one fader moves the unlocked others in proportion, so the channels always sum to the total, and a locked channel stays put. Each fader is UI SDK's vertical slider with an LED meter, each lock a UI SDK toggle, with setChannel, setAll and lock for agents.

Example

Search
Social
Email
Events
Total
100%

Installation

npx shadcn@latest add @eskais/mixer
npm packageslucide-react

Usage

Import
import { Mixer, mixerLabels } from "@/components/ui/mixer"import { mixer } from "@/components/ui/mixer-primitive"import { blocked, ceilingOf, evenly, rebalance, sumOf, unitsOf } from "@/components/ui/mixer-balance"

Reach for it to split a whole between a few parts, like a budget, model weights or traffic: one fader up takes from the others in proportion, and a lock keeps a part fixed.

API reference

Mixer

PropTypeDefault
labelrequiredThe accessible name of the mixer as a whole.string–
channelsrequiredreadonly MixerChannel[]–
valueEach channel's share by id. Pass it to control the mixer; the values should sum to `total`.MixerValues–
defaultValueThe total split evenly by default.MixerValues–
onValueChangeRuns on every step of a drag, a key or an agent's call, with every channel's new value.(values: MixerValues, details: MixerChangeDetails) => void–
onValueCommitRuns once a drag, a key press or an agent's call that changed the values ends, for saving.(values: MixerValues) => void–
lockedThe ids of the channels rebalancing leaves put. Pass it to control the locks.readonly string[]–
defaultLockedreadonly string[]noLocks
onLockedChange(locked: string[], details: MixerChangeDetails) => void–
totalWhat the channels always sum to; 100 by default.number100
stepThe smallest change of a channel; 1 by default. Page Up and Page Down move ten steps.number1
formatHow values read on the strips and for screen readers: `Intl.NumberFormat` options, or a function.Intl.NumberFormatOptions | ((value: number) => string)–
localeThe locale values are written in; the page's `lang`, or the runtime's default without one.string–
disabledbooleanfalse
labelsPartial<MixerLabels>–
classNameClasses for the root; a function gets the mixer's state.string | ((state: MixerState) => string | undefined)–

Other exports

mixerLabelsmixerblockedceilingOfevenlyrebalancesumOfunitsOftype MixerChangeDetailstype MixerChanneltype MixerLabelstype MixerPropstype MixerStatetype MixerValuestype MixerChannelInfotype MixerCommittype MixerLockCommittype MixerOptionstype Balancetype Blocked

Accessibility

  • Each fader is a vertical slider named by its channel: arrows step, Page Up and Page Down ten steps, Home and End the ends.
  • A locked channel's fader is read-only and stays focusable; each lock is a toggle named for its channel, with a tooltip.
  • The LED meters and the scale are decoration; the value is in each slider.

Agent actions

Agents find it by its label and call setChannel(id, value), setAll(values) or lock(id); a value the locked channels leave no room for, values that don't sum to the total, or moving a locked channel fail the step with why.

Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.