Socket
Socket
Sign inDemoInstall

svelte-switcher

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    svelte-switcher

A fully accessible, mobile-friendly and customisable toggle component for svelte apps.


Version published
Weekly downloads
65
increased by16.07%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Svelte Switcher

A fully accessible, mobile-friendly and customisable toggle component for svelte apps.

View examples and demo here

Installation

Install svelte-switcher with npm

  npm install svelte-switcher

Usage/Examples

Click here to view examples

<script>
    import Toggle from 'svelte-switcher'
</script>

<Toggle
    id="svelte-toggle"
    name="theme-toggle"
    defaultChecked={false}
    on:toggle={handleToggle}
    ...
/>

API

Props
PropsDescriptionDefault value
checkeddetermines if the toggle is activefalse
disableddetermines if the toggle is disabledfalse
onChangefires when toggle status changevoid
onFocusfires when toggle is focusedvoid
onBlurfires when toggle is unfocusedvoid
namename attr for the underlying input elementsvelte-switcher-name
valuevalue attr for the underlying input elementsvelte-switcher-value
idid attr for the underlying input elementsvelte-switcher-id
ariaLabelledByariaLabelledBy attr
ariaLabelariaLabel attr
Slots
Slot NameDescriptionDefault value
checked-componentSlot for checked state icon / component
unchecked-componentSlot for unchecked state icon / component
Events
Event NameDescriptionPayload
toggleFires when toggle status changesisChecked: boolean

Keywords

FAQs

Last updated on 09 Dec 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc