{"id":28243750,"url":"https://github.com/bronsondunbar/library-select-component","last_synced_at":"2026-04-14T06:33:46.357Z","repository":{"id":126599285,"uuid":"131838079","full_name":"bronsondunbar/library-select-component","owner":"bronsondunbar","description":"Select component for React [NPM Package]","archived":false,"fork":false,"pushed_at":"2018-08-06T13:13:57.000Z","size":134,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-12T13:43:29.848Z","etag":null,"topics":["nodejs","nodemodule","react","reactcomponent"],"latest_commit_sha":null,"homepage":"https://bronsondunbar.com/select-component-for-react-npm-package/","language":"CSS","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/bronsondunbar.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-05-02T10:57:33.000Z","updated_at":"2018-10-04T14:18:30.000Z","dependencies_parsed_at":"2023-06-17T09:30:18.920Z","dependency_job_id":null,"html_url":"https://github.com/bronsondunbar/library-select-component","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bronsondunbar/library-select-component","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bronsondunbar%2Flibrary-select-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bronsondunbar%2Flibrary-select-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bronsondunbar%2Flibrary-select-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bronsondunbar%2Flibrary-select-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bronsondunbar","download_url":"https://codeload.github.com/bronsondunbar/library-select-component/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bronsondunbar%2Flibrary-select-component/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31785677,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T02:24:21.117Z","status":"ssl_error","status_checked_at":"2026-04-14T02:24:20.627Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["nodejs","nodemodule","react","reactcomponent"],"created_at":"2025-05-19T07:07:58.118Z","updated_at":"2026-04-14T06:33:46.344Z","avatar_url":"https://github.com/bronsondunbar.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Select Component\n\nSelect component for React\n\nInstall and save component as a dependency\n\n```\n\nnpm install --save library-select-component\n\n```\n\nImport component into your app\n\n```\n\nimport Select from 'library-select-component'\n\n```\n\nCreate an array of objects with the keys being name and id\n\n```\n\nconst selectData = [\n  {\n    name: 'Item one',\n    id: 'one'\n  },\n  {\n    name: 'Item two',\n    id: 'two'\n  },\n  {\n    name: 'Item three',\n    id: 'three'\n  }\n]\n\n```\n\nCreate and assign active select state with empty value\n\n```\n\nconstructor(props) {\n  super(props)\n\n  this.state = {\n    activeSelect: ''\n  }\n}\n\n```\n\nCreate the function that will handle the active select state\n\n```\n\nactiveSelect (event) {\n  this.setState({ activeSelect: event.target.innerText })\n}\n\n```\n\nCreate the function that will show the select options\n\n```\n\nshowSelectOptions (event) {\n  event.target.offsetParent.lastChild.classList.toggle(\"show\");\n}\n\n```\n\nCreate the function that will hide the select options\n\n```\n\nhideSelectOptions (event) {\n  event.preventDefault();\n  event.target.offsetParent.classList.toggle(\"show\");\n}\n\n```\n\nCreate the function that will generate the select options\n\n```\n\nselectOptions () {\n  const selectData = [\n    {\n      name: 'Item one',\n      id: 'one'\n    },\n    {\n      name: 'Item two',\n      id: 'two'\n    },\n    {\n      name: 'Item three',\n      id: 'three'\n    }\n  ]\n\n  return selectData.map((data) =\u003e {\n    return (\n      \u003ca\n        className=\"dropdown-item\"\n        key={data.id}\n        onMouseUp={this.hideSelectOptions.bind(this)}\n        onClick={this.activeSelect.bind(this)} \u003e\n          {data.name}\n      \u003c/a\u003e\n    )\n  })\n}\n\n```\n\nRender the component with the functions we created, object array as well as any other props that are needed\n\n```\n\nrender() {\n  return (\n    \u003cFragment\u003e\n      \u003cSelect\n        selectOptions={this.selectOptions()}\n        selectTheme=\"dark\"\n        showSelectOptions={this.showSelectOptions.bind(this)}\n        placeHolder=\"Please select...\"\n        selectedText={!this.state.activeSelect ? null : this.state.activeSelect} /\u003e\n    \u003c/Fragment\u003e\n  )\n}\n\n```\n\n\n| Prop              | Values                     |\n| :---------------- | :------------------------- |\n| selectOptions     | Object                     |\n| selectTheme       | light or dark              |\n| showSelectOptions | showSelectOptions function |\n| hideSelectOptions | hideSelectOptions function |\n| placeHolder       | String                     |\n| selectedText      | String                     |","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbronsondunbar%2Flibrary-select-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbronsondunbar%2Flibrary-select-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbronsondunbar%2Flibrary-select-component/lists"}