API Reference
Complete API documentation for components, utilities, and framework core
Toggle
Toggle switch with moving dot animation
🔧 Props
| Property | Type | Default | Description |
|---|---|---|---|
| id | string | toggle-{timestamp} | Unique identifier |
| label | string | undefined | Label text |
| checked | State|boolean | false | Current state |
| onchange | function | undefined | Change handler |
| message | object | undefined | Validation message |
| containerClass | string | - | Container classes (vwfcolor, vwfsize) |
🎨 Utility Classes
| Pattern | Description |
|---|---|
| vwfcolor-{color} | Sets toggle color |
| vwfsize-{size} | Controls toggle size |
💻 Examples
Simple Toggle
javascript•Simple Toggle
const enabled = van.state(false);
return Toggle({
label: 'Enable notifications',
checked: enabled,
onchange: (e) => enabled.val = e.target.checked
});▶️ Live Preview
💡 Click "Edit Code" to modify the example
🔄 Click "Apply Changes" to see your modifications
↩️ Click "Reset" to restore original code
💡 Usage Tips
🔗 Related
Explore vwf
Discover what vwf can do