{"id":29806352,"url":"https://github.com/shahabvshahabi1996/use-react-switch","last_synced_at":"2026-05-19T19:02:12.115Z","repository":{"id":57388306,"uuid":"181708015","full_name":"shahabvshahabi1996/use-react-switch","owner":"shahabvshahabi1996","description":"This is a reusable and customizable react toggle switch component","archived":false,"fork":false,"pushed_at":"2019-05-01T19:56:23.000Z","size":131,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-26T11:17:41.087Z","etag":null,"topics":["es6","es6-javascript","es6-modules","javascript","reactjs","reusable","reusable-components","switch","toggle-switches"],"latest_commit_sha":null,"homepage":"https://codesandbox.io/s/0yn4zyjoxv?fontsize=14","language":"JavaScript","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/shahabvshahabi1996.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}},"created_at":"2019-04-16T14:38:03.000Z","updated_at":"2020-07-22T14:11:54.000Z","dependencies_parsed_at":"2022-09-02T04:01:22.464Z","dependency_job_id":null,"html_url":"https://github.com/shahabvshahabi1996/use-react-switch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shahabvshahabi1996/use-react-switch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahabvshahabi1996%2Fuse-react-switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahabvshahabi1996%2Fuse-react-switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahabvshahabi1996%2Fuse-react-switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahabvshahabi1996%2Fuse-react-switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shahabvshahabi1996","download_url":"https://codeload.github.com/shahabvshahabi1996/use-react-switch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahabvshahabi1996%2Fuse-react-switch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267319470,"owners_count":24068506,"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","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["es6","es6-javascript","es6-modules","javascript","reactjs","reusable","reusable-components","switch","toggle-switches"],"created_at":"2025-07-28T14:09:48.090Z","updated_at":"2026-05-19T19:02:07.095Z","avatar_url":"https://github.com/shahabvshahabi1996.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 😻 use-react-switch\n\n\u003e \n\n[![NPM](https://img.shields.io/npm/v/use-react-switch.svg)](https://www.npmjs.com/package/use-react-switch) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Install 😎\n\n```bash\nnpm install --save use-react-switch\n```\n\n\n## Usage 🤔\n\n```jsx\nimport React, { Component } from 'react'\n\nimport Switch from 'use-react-switch'\n\nclass Example extends Component {\n  \n  constructor() {\n    super();\n    this.state = {\n      isOpen : false\n    }\n  }\n\n  render () {\n    let {isOpen} = this.state;\n    return (\n      \u003cSwitch\n        name=\"switch\"\n        onClick={() =\u003e this.setState({isOpen : !isOpen})}\n        isOpen={isOpen}\n      /\u003e\n    )\n  }\n}\n```\n\n## Props\n| Props |Default Value| Type | Description |\n|-----|-----|-----|----|\n| **isOpen** | **false** | Boolean | Shows the status of switch (Open Or Close) |\n| **onClick** | ____ | Function | ____ |\n| **name** |  ____ | String | name of your swicth component for handling states |\n| **containerStyles** | ____ | Object | inline-styles for your switch container |\n| **toggleStyles** | ____ | Object | inline-styles for switch toggle | \n\n## Demo 😍 \nThis is how it looks but if you looking for something live click [here 👇](https://codesandbox.io/s/0yn4zyjoxv?fontsize=14)\n\n![use-react-switch](https://user-images.githubusercontent.com/19559766/56836882-c8cbfd00-688d-11e9-9794-9dd040154326.png)\n\n#### Or you can run it locally 🎉\n\nFirst you need to clone it : \n`git clone https://github.com/shahabvshahabi1996/use-react-switch.git`\n\nThen hit :\n`npm start` || `yarn start`\n\nAfter that go to example directory and hit : \n`npm start`\n\nNow you can check it out on your `http://localhost:3000/`\n\n\n## License 📃\n\nMIT © [shahabvshahabi1996](https://github.com/shahabvshahabi1996)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahabvshahabi1996%2Fuse-react-switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshahabvshahabi1996%2Fuse-react-switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahabvshahabi1996%2Fuse-react-switch/lists"}