{"id":17445643,"url":"https://github.com/ziad-saab/react-checkbox-group","last_synced_at":"2025-04-05T23:08:47.389Z","repository":{"id":19670486,"uuid":"22924035","full_name":"ziad-saab/react-checkbox-group","owner":"ziad-saab","description":"Sensible checkbox groups manipulation for DOM.","archived":false,"fork":false,"pushed_at":"2020-06-02T22:17:31.000Z","size":3333,"stargazers_count":107,"open_issues_count":6,"forks_count":54,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T22:07:51.029Z","etag":null,"topics":["checkbox","javascript","react"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/ziad-saab.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":"2014-08-13T17:10:48.000Z","updated_at":"2024-09-15T10:19:58.000Z","dependencies_parsed_at":"2022-08-24T02:51:11.871Z","dependency_job_id":null,"html_url":"https://github.com/ziad-saab/react-checkbox-group","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziad-saab%2Freact-checkbox-group","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziad-saab%2Freact-checkbox-group/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziad-saab%2Freact-checkbox-group/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ziad-saab%2Freact-checkbox-group/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ziad-saab","download_url":"https://codeload.github.com/ziad-saab/react-checkbox-group/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411234,"owners_count":20934653,"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":["checkbox","javascript","react"],"created_at":"2024-10-17T18:06:29.572Z","updated_at":"2025-04-05T23:08:47.364Z","avatar_url":"https://github.com/ziad-saab.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [React](http://facebook.github.io/react/)-checkbox-group\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/ziad-saab/react-checkbox-group.svg)](https://greenkeeper.io/)\n[![Build Status](https://travis-ci.org/ziad-saab/react-checkbox-group.svg?branch=master)](https://travis-ci.org/ziad-saab/react-checkbox-group)\n\nThis is your average checkbox group:\n\n```html\n\u003cform\u003e\n  \u003cinput\n    onChange=\"{handleFruitChange}\"\n    type=\"checkbox\"\n    name=\"fruit\"\n    value=\"apple\"\n  /\u003eApple\n  \u003cinput\n    onChange=\"{handleFruitChange}\"\n    type=\"checkbox\"\n    name=\"fruit\"\n    value=\"orange\"\n  /\u003eOrange\n  \u003cinput\n    onChange=\"{handleFruitChange}\"\n    type=\"checkbox\"\n    name=\"fruit\"\n    value=\"watermelon\"\n  /\u003eWatermelon\n\u003c/form\u003e\n```\n\nRepetitive, hard to manipulate and easily desynchronized.\nLift up `name` and `onChange`, and give the group an initial checked values array.\nSee below for a [complete example](#example)\n\n## Install\n\n```sh\nnpm install react-checkbox-group\n```\n\nor\n\n```sh\nyarn add react-checkbox-group\n```\n\nSimply require/import it to use it:\n\n```tsx\nimport CheckboxGroup from 'react-checkbox-group'\n```\n\n## Example\n\n```tsx\nimport React, { useState, useEffect } from 'react'\nimport CheckboxGroup from 'react-checkbox-group'\n\nconst Demo = () =\u003e {\n  // Initialize the checked values\n  const [fruits, setFruits] = useState\u003cstring[]\u003e(['apple', 'watermelon'])\n\n  useEffect(() =\u003e {\n    const timer = setTimeout(() =\u003e {\n      setFruits(['apple', 'orange'])\n    }, 5000)\n\n    return () =\u003e clearTimeout(timer)\n  }, [])\n\n  return (\n    \u003cCheckboxGroup name=\"fruits\" value={fruits} onChange={setFruits}\u003e\n      {(Checkbox) =\u003e (\n        \u003c\u003e\n          \u003clabel\u003e\n            \u003cCheckbox value=\"apple\" /\u003e Apple\n          \u003c/label\u003e\n          \u003clabel\u003e\n            \u003cCheckbox value=\"orange\" /\u003e Orange\n          \u003c/label\u003e\n          \u003clabel\u003e\n            \u003cCheckbox value=\"watermelon\" /\u003e Watermelon\n          \u003c/label\u003e\n        \u003c/\u003e\n      )}\n    \u003c/CheckboxGroup\u003e\n  )\n}\n\nReactDOM.render(\u003cDemo /\u003e, document.body)\n```\n\n## License\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziad-saab%2Freact-checkbox-group","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fziad-saab%2Freact-checkbox-group","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fziad-saab%2Freact-checkbox-group/lists"}