{"id":22378899,"url":"https://github.com/codebrahma/react-simple-switch","last_synced_at":"2025-03-26T18:47:35.982Z","repository":{"id":42096293,"uuid":"235309350","full_name":"Codebrahma/react-simple-switch","owner":"Codebrahma","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-04T01:23:57.000Z","size":2322,"stargazers_count":0,"open_issues_count":10,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-19T12:02:07.907Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Codebrahma.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":"2020-01-21T09:53:15.000Z","updated_at":"2021-11-08T05:31:18.000Z","dependencies_parsed_at":"2023-02-15T07:16:28.064Z","dependency_job_id":null,"html_url":"https://github.com/Codebrahma/react-simple-switch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codebrahma%2Freact-simple-switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codebrahma%2Freact-simple-switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codebrahma%2Freact-simple-switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codebrahma%2Freact-simple-switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Codebrahma","download_url":"https://codeload.github.com/Codebrahma/react-simple-switch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245718005,"owners_count":20661154,"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-04T23:08:16.289Z","updated_at":"2025-03-26T18:47:35.968Z","avatar_url":"https://github.com/Codebrahma.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-simple-switch\n\n\u003e A customizable multi state toggle switch library for react\n\n[![NPM](https://img.shields.io/npm/v/react-simple-switch.svg)](https://www.npmjs.com/package/react-simple-switch) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n\u003cimg src=\"https://react-multistate-toggler-demo.netlify.com/static/toggler-demo-3bba9d96c11ed083cf27739d4ebca848.gif\" /\u003e\n\n## Install\n\n```bash\nnpm i react-simple-switch\n```\n\n## Documentation\n\nRead the full Documentation [here](https://react-simple-switch-demo.netlify.com)\n\n## Advantages\n\nCreate highly customizable toggle switches with ease. Create toggle switches with 3 states.\n\n## Usage\n\n### Basic usage\n\n```jsx\nimport React, { Component } from 'react';\nimport ToggleButton from 'react-simple-switch';\n\nexport default class App extends Component {\n  state = {\n    toggleState: null\n  };\n\n  handleChange = toggleState =\u003e {\n    this.setState({ toggleState });\n  };\n\n  render() {\n    const { toggleState } = this.state;\n    return (\n      \u003cdiv\u003e\n        \u003cp\u003e\n          Do you like Pizzas:{' '}\n          \u003cspan style={{ color: toggleState ? 'blue' : 'red' }}\u003e\n            {toggleState ? 'YES' : 'NO'}\n          \u003c/span\u003e\n        \u003c/p\u003e\n        \u003cToggleButton\n          onChange={this.handleChange}\n          initState={true}\n          buttonDesign=\"angled\"\n          textData={{ stateOne: 'YES', stateTwo: 'NO' }}\n        /\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n```\n\n### Creating toggle button with 3 states\n\n```jsx\nimport React, { Component } from \"react\";\nimport ToggleButton from \"react-simple-switch\";\n\nexport default class App extends Component {\n  state = {\n    toggleState: false\n  };\n\n  handleChange = toggleState =\u003e {\n    this.setState({ toggleState });\n  };\n\n  getGender = () =\u003e {\n    const { toggleState } = this.state;\n    const genders = ['Female', 'Male', 'Other'];\n    return genders[toggleState - 1];\n  }\n\n  render() {\n    return (\n      \u003cdiv\u003e\n        \u003cp\u003eChoose your gender \u003cspan\u003e{this.getGender()}\u003c/span\u003e\u003c/p\u003e\n        \u003cToggleButton\n          onChange={this.handleChange}\n          initState={true}\n          buttonDesign='rounded'\n          buttonStates={3}\n          fontSize='12px'\n          textData={ stateOne: 'M', stateTwo: 'F', stateThree: 'O' }\n        /\u003e\n      \u003c/div\u003e\n    );\n  }\n}\n```\n\n## License\n\nMIT © [Manoj Bhat](https://github.com/Sigkill32)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebrahma%2Freact-simple-switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodebrahma%2Freact-simple-switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebrahma%2Freact-simple-switch/lists"}