{"id":23039316,"url":"https://github.com/javadbat/jb-switch-react","last_synced_at":"2025-08-14T19:32:11.064Z","repository":{"id":57279736,"uuid":"185609676","full_name":"javadbat/jb-switch-react","owner":"javadbat","description":"react switch btn","archived":false,"fork":false,"pushed_at":"2024-11-23T14:15:01.000Z","size":164,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-23T15:23:23.989Z","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":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2019-05-08T13:18:07.000Z","updated_at":"2024-11-23T14:15:05.000Z","dependencies_parsed_at":"2024-11-23T15:21:26.727Z","dependency_job_id":"ed2dc23d-d74f-4a81-8245-51999feb3107","html_url":"https://github.com/javadbat/jb-switch-react","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"5309b5805182c01d52ccc1599366c0fc67e705da"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javadbat%2Fjb-switch-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javadbat%2Fjb-switch-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javadbat%2Fjb-switch-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javadbat%2Fjb-switch-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/javadbat","download_url":"https://codeload.github.com/javadbat/jb-switch-react/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229859841,"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.624Z","updated_at":"2025-08-14T19:32:11.059Z","avatar_url":"https://github.com/javadbat.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jb-switch-react\n\n\u003e [!WARNING]  \n\u003e this package is deprecated and moved to [jb-switch/react](https://github.com/javadbat/jb-switch/tree/main/react)\n\nsimple switch component for react with loading ability\nsample:\u003chttps://codepen.io/javadbat/pen/jOyXKNJ\u003e\n\n## installation\n\nrun `npm install jb-switch-react` to install package with npm\n\n## usage\n\nimport component in your page `import {JBSwitch} from 'jb-switch-react'`  \n\nuse below syntax in your render function\n\n```jsx\n\u003cJBSwitch value={booleanValue} isLoading={isLoading} trueTitle='true caption' falseTitle='false caption' onChange={(e)=\u003eonChange(e)} \u003e\u003c/JBSwitch\u003e\n```\n\nas you can see in above example `value` is on-way binding like normal react forms input trueTitle is a title that place on true side of component and get bold on `value == true` onChange is standard too  \nif you want to show loading in switch just make `isLoading = true`\n\n```javascript\n onChange(e){\n     setIsLoading(true)\n    return new Promise((resolve,reject)=\u003e{\n        fetch(request).then((response)=\u003ereturn response.json).then((data)=\u003e{\n            setIsLoading(false)\n            resolve();\n        })\n    })\n}\n```\n\ndemo image:    \n![](demo-gif.gif)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavadbat%2Fjb-switch-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjavadbat%2Fjb-switch-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavadbat%2Fjb-switch-react/lists"}