LB01 Label Positioning
Control where labels appear relative to the switch
Live Demo
Code
Position Guidelines
Position Options
top— Above the switchbottom— Below the switch (default)left— To the left (vertical only)right— To the right (vertical only)
💡 Tip: Block render mode
All examples on this page use labelRenderMode="block", which
reserves space for labels in document flow. This is the recommended mode for
most layouts.
labelRenderMode="absolute" is the legacy default — labels are
absolutely positioned and don't reserve space, requiring manual padding on
the container. See the next section for the comparison.
LB02 Label Render Mode
Choose between absolute and block positioning for labels
Live Demo
Absolute Mode (Default)
Block Mode
Block Mode — Vertical
Code
Render Mode Comparison
Render Modes
absolute(default)- Labels use absolute positioning
- Don't affect layout flow
- Require manual padding
- More control over exact positioning
block- Labels use static positioning
- Take up space in document flow
- No padding needed
- Simpler to use, less flexible
Recommendation
Use block for most layouts; reach for absolute only when you need fixed-position label overlay (e.g., compact toolbars).
LB03 Label Content (labelMember & labelCallback)
Automatic label text from object items, plus clickable per-step labels
Live Demo
1. labelMember Property
2. labelCallback Function
3. Clickable Labels (Vertical Mode)
Per-step labels become real
<button>s when no thumb snippet is provided.4. Label Priority System
Code
Feature Details
Object-aware label resolution
Both ways read structured data without writing a snippet.
1. labelMember
- Extracts label text from an item property
- Example:
labelMember="name"readsitem.name - Null-safe: skips if property doesn't exist
2. labelCallback
- Custom function:
(item: T, index: number) => string - Access to both item data and index
- Ideal for computed or formatted labels
3. Clickable Labels
- Available in vertical mode with left/right positions
- Active when no
thumbsnippet is provided - Renders real
<button>elements with keyboard activation
Label Priority
labelsnippet (full custom)labelMember(object property)labelCallback(computed string)- Default: "Option N"
LB04 Custom label snippet
Rich label content via the label snippet (renamed from labelTemplate in 2.0)
Live Demo
Code
Snippet Features
label snippet (v2.0)
The label snippet (renamed from 1.x's labelTemplate)
gives full control over per-item label rendering.
Snippet Parameters
index— Index of this item (wascurrentIndex)item— The item data (typed asT | undefined)isSelected— Boolean for selection state
When to Use
- Multi-line labels with descriptions
- Icons with text
- Conditional content based on selection
- Custom styling per state
LB05 Label Visibility
Control when to show or hide labels
Live Demo
Code
Visibility Guidelines
When to Hide Labels
- When space is limited
- When using self-explanatory icons
- In compact UI designs
- When labels are shown elsewhere
Note: segment vs thumb
The icons example uses the segment snippet — it renders once
per step background. Use thumb instead if you only want content
inside the moving thumb.
Label Best Practices
📝 Content Guidelines
- ✅ Keep labels concise and clear
- ✅ Use consistent terminology
- ✅ Consider internationalization
- ✅ Test with different text lengths
- ✅ Ensure sufficient contrast
🎯 Layout Tips
- ✅ Default to
labelRenderMode="block" - ✅ Reach for
"absolute"only when needed - ✅ Use
labelMemberfor simple object items - ✅ Use
labelCallbackfor computed strings - ✅ Use the
labelsnippet for rich content