Custom Thumb Templates
Replace the default thumb with custom content
Live Demo
Custom Icon Thumb: Night Mode
🌙
Power Switch: Power: ON
ON
Code
Thumb Customization
thumbTemplate Snippet
The thumbTemplate snippet receives context about the current state
and allows you to render custom content inside the thumb.
Available Parameters
currentIndex- Current selected indexcurrentItem- Current item dataitemsCount- Total number of items
Custom Children Templates
Customize the content and layout of switch items
Live Demo
Status Monitor:
🟢
Online🔴
Offline🟡
Warning🟢
OnlineOnline
Fully operational
Media Controls: Action: Previous
⏮️
⏮️
▶️
⏸️
⏭️
Previous
Code
Children Customization
children Snippet
The children snippet allows you to completely customize
the content rendered for each switch option.
Available Parameters
currentIndex- Index of this itemitem- The item dataisSelected- Whether this item is selected
Custom Label Templates
Advanced label customization for MultiSwitch
Live Demo
Power Levels:
Normal
50%
Quality Settings:
Low • 480p • ~200MB
Medium • 720p • ~500MB
High • 1080p • ~1GB
Ultra • 4K • ~4GB
Code
Label Customization
labelTemplate Snippet
The labelTemplate snippet gives you complete control over
how labels are rendered for each option.
Rich Label Content
Labels can include multiple lines, colors, icons, and any other HTML/Svelte content you need.
Complete Custom Example
Combining all templating features
Live Demo
Theme Selector:
Dark
☀️
🌙
🔄
Dark Theme
Easy on the eyes
Code
Advanced Integration
Complete Customization
This example combines all templating features: custom children, thumb template, label template, and individual styling.
Real-world Use Cases
- Theme selectors
- Media players
- Dashboard controls
- Configuration panels
Templates with Disabled State
Disabled Custom Switch: Locked
🔒
Performance & Best Practices
⚡ Performance Tips
- ✅ Keep template logic simple
- ✅ Avoid heavy computations in templates
- ✅ Use `$derived` for computed values
- ✅ Minimize DOM elements in templates
- ✅ Cache expensive operations
🎯 Template Guidelines
- ✅ Design for touch interfaces
- ✅ Ensure content fits in available space
- ✅ Test with different data lengths
- ✅ Consider loading states
- ✅ Maintain consistent styling