FilmStripDiscreteControl
A discrete control that displays frames from a filmstrip sprite sheet, supporting the industry-standard bitmap-based control representation.
FilmStripDiscreteControl is a discrete control that displays frames from a filmstrip sprite sheet. It supports the widely-used industry standard for control representation: bitmap sprite sheets (filmstrips).
While bitmap-based visualization is more constrained than SVG (no dynamic theming, fixed visual appearance), this component shares the same layout, parameter model, interaction, and accessibility as other controls (vector, raster, and control primitives); see the Raster introduction.
The frame displayed is determined by mapping the current value to a frame index based on the number of options.
Note:
No Theming Support: This component does NOT support themable props (color, roundness, thickness) as visuals are entirely determined by the image content.
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
value | string | number | — | Yes | Current value of the control |
onChange | (event: AudioControlEvent<string | number>) => void | — | No | Handler for value changes |
label | string | — | No | Label displayed below the component |
frameWidth | number | — | Yes | Width of a single frame in the filmstrip (pixels) |
frameHeight | number | — | Yes | Height of a single frame in the filmstrip (pixels) |
frameCount | number | — | Yes | Total number of frames in the filmstrip sprite sheet |
imageHref | string | — | Yes | URL to the sprite sheet/filmstrip image |
orientation | "vertical" | "horizontal" | vertical | No | Orientation of the filmstrip (frames stacked vertically or horizontally) |
frameRotation | number | 0 | No | Optional frame rotation in degrees |
adaptiveSize | boolean | false | No | Whether the component stretches to fill its container |
size | "xsmall" | "small" | "normal" | "large" | "xlarge" | normal | No | Size of the component |
parameter | DiscreteParameter | — | No | Audio Parameter definition (Model). If provided, overrides options/label from ad-hoc props |
options | Array<{ value: string | number; label?: string; midiValue?: number }> | — | No | Array of option definitions (strict mode) |
children | React.ReactNode | — | No | OptionView children for ad-hoc or hybrid mode |
Understanding Options vs Children
FilmStripDiscreteControl distinguishes between two concepts:
optionsprop: Defines the parameter model (value, label, midiValue). Used for parameter structure.children(OptionView components): In this component, discrete visuals are handled by the filmstrip image (each frame), not by OptionView content. OptionView here is mainly syntactic sugar: it populates the option set in ad-hoc mode (values and count); the component uses the number of OptionView children to derive frame index. The visual content inside OptionView (e.g. text or icons) is never displayed.
These serve different purposes and can be used together: use options or a parameter when you have data-driven option definitions or need MIDI mapping; use OptionView children for simple, ad-hoc setups when you want the option set inferred from the children.
Note:
Basic use: For basic use of FilmStripDiscreteControl, and especially when using ad-hoc props (no parameter prop), prefer OptionView children. In that case the option set is inferred from the OptionViews and the frame count should match the number of options. Use the options prop or a full parameter when you need explicit parameter structure (e.g. data-driven options, MIDI mapping). For a full disambiguation of options vs OptionView, see Options vs OptionView.
Basic Usage
FilmStripDiscreteControl requires a filmstrip sprite sheet image and frame dimensions. Use OptionView children to define the discrete options:
Modes of Operation
FilmStripDiscreteControl supports three modes of operation:
Ad-Hoc Mode (Children Only)
Model inferred from OptionView children:
Strict Mode (Parameter Only)
Model provided via parameter prop. The following example uses children (OptionView); with the full library you would use createDiscreteParameter and the parameter prop:
Hybrid Mode (Parameter + Children)
Model from parameter, View from children (matched by value). Use the same pattern as Strict Mode with OptionView children when the parameter is not in scope.
Frame Mapping
The component maps discrete option values to frame indices:
- Option index 0 → Frame 0
- Option index 1 → Frame 1
- Option index N → Frame N
The number of frames in the filmstrip should match the number of options.
Filmstrip Configuration
Frame Dimensions
Specify the dimensions of a single frame:
Orientation
Control whether frames are stacked vertically or horizontally:
Frame Rotation
Rotate the entire filmstrip container:
Adaptive Sizing
The FilmStripDiscreteControl component supports both fixed sizes and adaptive sizing. By default, the size of the component is driven by the Size System and their size attribute:
Adaptive sizing allows the component to adapt to the size of its parent container, adjusting its dimensions intelligently without causing distortion (scaleToFit display mode). The fill display mode makes the component fill the entire container, potentially distorting it.
Common Use Cases
Traffic Light (Multiple States)
Waveform Selector
Filmstrip Image Format
Filmstrip images should follow these conventions:
- Vertical orientation (default): Frames stacked top to bottom
- Horizontal orientation: Frames stacked left to right
- Frame dimensions: All frames must have identical dimensions
- Frame count: Must match the number of discrete options
- Compatibility: Works with filmstrips exported from WebKnobMan and other VST development tools
Next Steps
- Explore FilmStripContinuousControl for continuous parameter control
- Learn about FilmStripBooleanControl for boolean switches
- Check out the playground for interactive examples