Toggle - 图1

Toggle Svelte Component

Toggle Svelte component represents Toggle component.

Toggle Components

There are following components included:

  • Toggle

Toggle Properties

PropTypeDefaultDescription
<Toggle> properties
initbooleantrueInitializes Toggle
namestringToggle input name
valuestring
number
Toggle input value
checkedbooleanfalseDefines whether the toggle input is checked or not
disabledbooleanfalseDefines whether the toggle input is disabled or not
readonlybooleanfalseDefines whether the toggle input is readonly or not

Toggle Events

EventDescription
<Toggle> events
changeEvent 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
toggleChangeEvent will be triggered when toggle checkbox state changed

Toggle Methods

EventDescription
<Toggle> methods
.toggle()Toggle checkbox state

Examples

  1. <Page>
  2. <Navbar title="Toggle"></Navbar>
  3. <BlockTitle>Super Heroes</BlockTitle>
  4. <List simpleList>
  5. <ListItem>
  6. <span>Batman</span>
  7. <Toggle checked></Toggle>
  8. </ListItem>
  9. <ListItem>
  10. <span>Aquaman</span>
  11. <Toggle checked color="blue"></Toggle>
  12. </ListItem>
  13. <ListItem>
  14. <span>Superman</span>
  15. <Toggle checked color="red"></Toggle>
  16. </ListItem>
  17. <ListItem>
  18. <span>Hulk</span>
  19. <Toggle color="green"></Toggle>
  20. </ListItem>
  21. <ListItem>
  22. <span>Spiderman (Disabled)</span>
  23. <Toggle disabled></Toggle>
  24. </ListItem>
  25. <ListItem>
  26. <span>Ironman (Disabled)</span>
  27. <Toggle checked disabled></Toggle>
  28. </ListItem>
  29. <ListItem>
  30. <span>Thor</span>
  31. <Toggle checked color="orange"></Toggle>
  32. </ListItem>
  33. <ListItem>
  34. <span>Wonder Woman</span>
  35. <Toggle color="pink"></Toggle>
  36. </ListItem>
  37. </List>
  38. </Page>
  39. <script>
  40. import {Page, Navbar, BlockTitle, List, ListItem, Toggle} from 'framework7-svelte';
  41. </script>

← Text Editor

Toolbar / Tabbar →