Toggle Svelte Component
Toggle Svelte component represents Toggle component.
Toggle Components
There are following components included:
Toggle
Toggle Properties
Prop | Type | Default | Description |
---|---|---|---|
<Toggle> properties | |||
init | boolean | true | Initializes Toggle |
name | string | Toggle input name | |
value | string number | Toggle input value | |
checked | boolean | false | Defines whether the toggle input is checked or not |
disabled | boolean | false | Defines whether the toggle input is disabled or not |
readonly | boolean | false | Defines whether the toggle input is readonly or not |
tooltip | string | tooltip text to show on hover/press | |
tooltipTrigger | string | hover | Defines how to trigger (open) Tooltip. Can be hover , click or manual |
Toggle Events
Event | Description |
---|---|
<Toggle> events | |
change | Event will be triggered when toggle checkbox state changed. This event may not occur on touch devices, so it is better to use next toggle:change event instead |
toggleChange | Event will be triggered when toggle checkbox state changed |
Toggle Methods
<Toggle> methods | |
---|---|
.toggle() | Toggle checkbox state |
Examples
toggle.svelte
<script>
import { Navbar, Page, BlockTitle, List, ListItem, Toggle } from 'framework7-svelte';
</script>
<Page>
<Navbar title="Toggle" />
<BlockTitle>Super Heroes</BlockTitle>
<List simpleList strong outlineIos dividersIos>
<ListItem>
<span>Batman</span>
<Toggle checked />
</ListItem>
<ListItem>
<span>Aquaman</span>
<Toggle checked color="blue" />
</ListItem>
<ListItem>
<span>Superman</span>
<Toggle checked color="red" />
</ListItem>
<ListItem>
<span>Hulk</span>
<Toggle color="green" />
</ListItem>
<ListItem>
<span>Spiderman (Disabled)</span>
<Toggle disabled />
</ListItem>
<ListItem>
<span>Ironman (Disabled)</span>
<Toggle checked disabled />
</ListItem>
<ListItem>
<span>Thor</span>
<Toggle checked color="orange" />
</ListItem>
<ListItem>
<span>Wonder Woman</span>
<Toggle color="pink" />
</ListItem>
</List>
</Page>