{"id":23039317,"url":"https://github.com/javadbat/jb-switch","last_synced_at":"2025-08-14T19:32:29.482Z","repository":{"id":219743619,"uuid":"749386582","full_name":"javadbat/jb-switch","owner":"javadbat","description":"switch web-component","archived":false,"fork":false,"pushed_at":"2024-11-23T15:39:45.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-30T16:56:58.032Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/javadbat.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-28T12:45:05.000Z","updated_at":"2024-11-23T15:39:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"735f3209-0397-4061-ace1-4357570b8543","html_url":"https://github.com/javadbat/jb-switch","commit_stats":null,"previous_names":["javadbat/jb-switch"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javadbat%2Fjb-switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javadbat%2Fjb-switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javadbat%2Fjb-switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javadbat%2Fjb-switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/javadbat","download_url":"https://codeload.github.com/javadbat/jb-switch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229859832,"owners_count":18135519,"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":[],"created_at":"2024-12-15T18:30:13.988Z","updated_at":"2025-08-14T19:32:29.469Z","avatar_url":"https://github.com/javadbat.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jb-switch\n\n\n[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/jb-switch)\n[![GitHub license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://raw.githubusercontent.com/javadbat/jb-switch/main/LICENSE)\n[![NPM Downloads](https://img.shields.io/npm/dw/jb-switch)](https://www.npmjs.com/package/jb-switch)\n\nswitch web-component with these benefits:\n\n- support loading state\n- pure js and ready to use\n- beautiful animation\n- customizable with your style with just css variable\n\n## using with JS frameworks\n\nto use this component in **react** see [`jb-switch/react`](https://github.com/javadbat/jb-switch/tree/main/react);\n\n## usage\n```terminal\nnpm i jb-switch\n```\n\n```html\n\u003cjb-switch true-title=\"my enable\" false-title=\"my-disable\"\u003e\u003c/jb-switch\u003e\n```\n### set loading\n```javascript\n\ndocument.querySelector(\"jb-switch\").isLoading = true; //true or false\n\n```\n### get/set value\n```javascript\nalert(document.querySelector(\"jb-switch\").value);\ndocument.querySelector(\"jb-switch\").value = true; //true or false\n\n```\n## set custom style\n\nin some cases in your project you need to change default style of web-component for example you need zero margin or different border-radius and etc.    \nif you want to set a custom style to this web-component all you need is to set css variable in parent scope of web-component.\n#### usage example:\n\n```css\nbody{\n  //if you want to change color of switch \n  --jb-switch-bg-color-active: green;\n}\n```\n#### variable list\n \n| css variable name                             | description                                                               |\n| -------------                                 | -------------                                                             |\n| --jb-switch-bg-color-active                   | background color of switch when value is true                             |\n| --jb-switch-bg-color                          | background color of switch when value is false                            |\n| --jb-switch-ring-color                        | trigger ring color when value is false                                    |\n| --jb-switch-ring-color-active                 | trigger ring color when value is true                                     |\n\n## Other Related Docs:\n\n- see [`jb-switch/react`](https://github.com/javadbat/jb-switch/tree/main/react) if you want to use this component in react.\n\n- see [All JB Design system Component List](https://javadbat.github.io/design-system/) for more components.\n\n- use [Contribution Guide](https://github.com/javadbat/design-system/blob/main/docs/contribution-guide.md) if you want to contribute in this component.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavadbat%2Fjb-switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjavadbat%2Fjb-switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavadbat%2Fjb-switch/lists"}