{"id":15064425,"url":"https://github.com/thecodejack/svelte-switch","last_synced_at":"2025-03-17T14:13:46.248Z","repository":{"id":41888512,"uuid":"280889761","full_name":"thecodejack/svelte-switch","owner":"thecodejack","description":"Svelte component for toggle/switch a button","archived":false,"fork":false,"pushed_at":"2024-10-10T17:11:06.000Z","size":380,"stargazers_count":27,"open_issues_count":19,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-20T05:10:01.212Z","etag":null,"topics":["svelte-components","sveltejs","toggle-buttons","toggle-switches"],"latest_commit_sha":null,"homepage":"https://svelte-switch.netlify.app/","language":"Svelte","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thecodejack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-19T15:04:59.000Z","updated_at":"2023-06-15T04:16:01.000Z","dependencies_parsed_at":"2022-09-07T13:40:14.174Z","dependency_job_id":"5475228b-92d0-4a3f-98d4-c3f9b74f8b98","html_url":"https://github.com/thecodejack/svelte-switch","commit_stats":{"total_commits":35,"total_committers":4,"mean_commits":8.75,"dds":0.3142857142857143,"last_synced_commit":"3c21d161094e0aafb9796fd1d697e3ee42bcad4e"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodejack%2Fsvelte-switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodejack%2Fsvelte-switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodejack%2Fsvelte-switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodejack%2Fsvelte-switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodejack","download_url":"https://codeload.github.com/thecodejack/svelte-switch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244047646,"owners_count":20389206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["svelte-components","sveltejs","toggle-buttons","toggle-switches"],"created_at":"2024-09-25T00:18:14.091Z","updated_at":"2025-03-17T14:13:46.187Z","avatar_url":"https://github.com/thecodejack.png","language":"Svelte","funding_links":[],"categories":[],"sub_categories":[],"readme":"# svelte-switch\r\n\r\n[![NPM](https://img.shields.io/npm/v/svelte-switch.svg)](https://www.npmjs.com/package/svelte-switch)\r\n[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/svelte-switch.svg)](https://www.npmjs.com/package/svelte-switch)\r\n\r\nSvelteJS component for switch or toggle a boolean. User would be able to drag or click for toggling.\r\n\r\n## Demo\r\n\r\n[Click here for Storybook link](https://svelte-switch.netlify.app/)\r\n\r\n[REPL Link](https://svelte.dev/repl/72a37aee9ae24705b7d874def7e1f270)\r\n\r\n## Installation\r\n\r\n```\r\nnpm install svelte-switch\r\n\r\nor\r\n\r\nyarn add svelte-switch\r\n```\r\n\r\n## Usage\r\n\r\n```svelte\r\n\u003cscript\u003e\r\n  import Switch from \"svelte-switch\";\r\n\r\n  let checkedValue = true;\r\n\r\n  function handleChange(e) {\r\n    const { checked } = e.detail;\r\n    checkedValue = checked;\r\n  }\r\n\u003c/script\u003e\r\n\r\n\u003ch1\u003eSimple usage\u003c/h1\u003e\r\nSwitch with default style\r\n\u003cSwitch on:change={handleChange} checked={checkedValue} /\u003e\r\n\u003cbr /\u003e\r\nThe switch is {checkedValue ? 'on' : 'off'}.\r\n\r\n```\r\n\r\n## API\r\n\r\n### Props\r\n\r\n| Prop Name       | Description    | Default Value      |\r\n| --------------- | -------------- | ------------------ |\r\n| checked         | Required field | undefined          |\r\n| disabled        |                | false              |\r\n| offColor        |                | \"#888\"             |\r\n| onColor         |                | \"#080\"             |\r\n| offHandleColor  |                | \"#fff\"             |\r\n| onHandleColor   |                | \"#fff\"             |\r\n| handleDiameter  |                | 0                  |\r\n| boxShadow       |                | null               |\r\n| activeBoxShadow |                | \"0 0 2px 3px #3bf\" |\r\n| height          |                | 28                 |\r\n| width           |                | 56                 |\r\n| id              |                | ''                 |\r\n| containerClass  |                | ''                 |\r\n\r\n### Slots\r\n\r\n| Slot Name     | Description | Default Set? |\r\n| ------------- | ----------- | ------------ |\r\n| checkedIcon   |             | Yes          |\r\n| unCheckedIcon |             | Yes          |\r\n\r\n### Events\r\n\r\n| Event Name | Description | `event.detail` info       |\r\n| ---------- | ----------- | ------------------------- |\r\n| change     |             | `{event: event, checked}` |\r\n\r\n### Examples\r\n\r\n[Click here](https://github.com/thecodejack/svelte-switch/tree/master/stories/views) to view stories implementation\r\n\r\n## Credits\r\n\r\nComponent is reimplementation [react-switch](https://github.com/markusenglund/react-switch). Complete credit goes to author and contributors of [react-switch](https://github.com/markusenglund/react-switch).\r\n\r\n## License\r\n\r\nMIT\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodejack%2Fsvelte-switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodejack%2Fsvelte-switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodejack%2Fsvelte-switch/lists"}