MS01 Basic Usage
Simple multi-option switch with labels
Live Demo
Code
Explanation
Two-way Binding
Use bind:selectedIndex to track which option is currently selected.
Items Array
Pass an array of strings or objects to define the available options.
The array type flows through to all snippet contexts via the generic T.
Block label rendering
labelRenderMode="block" reserves space for labels in document
flow — no manual padding needed.
MS02 Different Option Counts
MultiSwitch adapts to any number of options
Live Demo
Code
Guidelines
Flexible Options
MultiSwitch works with any number of items ≥ 2. The component automatically adjusts spacing and stride math.
Content Types
- Text labels
- Emoji characters
- Short abbreviations
- Custom objects (with
labelMember/labelCallback/labelsnippet)
MS03 Size Variations
Numeric and named sizes
Live Demo
Code
Size Guidelines
Choosing Size
- xs / sm: Sidebars, compact tables
- md (default): Forms — pure-admin aligned
- lg / xl or 60–80px: Touch targets, emphasis
Label Considerations
Larger switches give more room for labels and better touch targets. See the Sizes page for the full table.
MS04 Vertical Orientation
Vertical layout for space-constrained designs
Live Demo
Code
When to Use
Vertical Benefits
- Saves horizontal space
- Works well in sidebars
- Good for mobile layouts
- Per-step labels become clickable buttons (when no
thumbsnippet)
Label Positioning
Use "right" or "left" with vertical orientation. "top" / "bottom" are ignored on vertical switches.
MS05 Label Positioning
Control where labels appear relative to the switch
Live Demo
Code
Position Options
Available Positions
top— Above the switchbottom— Below the switch (default)left— To the left (vertical only)right— To the right (vertical only)
See also
The Labels page has the full matrix and
covers labelMember / labelCallback for object items.
MS06 Event Handling
Respond to selection changes
Live Demo
Code
Event Details
onItemChange Callback
The onItemChange prop accepts a function that receives
the newly selected index.
Common Use Cases
- Form validation
- Loading related data
- Updating other UI components
- Analytics tracking
MS07 Working with Custom Objects
Using the thumb and label snippets with object data
Live Demo
Code
Snippet Roles
v2.0 Snippet Split
The 1.x children snippet (which ran in BOTH the moving thumb and
each step background) was split in 2.0:
- thumb — one render in the moving thumb (gets the active
item) - segment — one render per step background
- label — replaces 1.x
labelTemplate
Snippet Context
Context shape is unified: { index, item, isSelected }. thumb omits isSelected (it's always true for the
moving thumb).