{"id":16611509,"url":"https://github.com/valerybugakov/react-selectable-fast","last_synced_at":"2025-07-12T02:40:08.300Z","repository":{"id":41384199,"uuid":"52871165","full_name":"valerybugakov/react-selectable-fast","owner":"valerybugakov","description":"Enable React components to be selectable via mouse/touch.","archived":false,"fork":false,"pushed_at":"2023-06-23T10:54:42.000Z","size":1582,"stargazers_count":267,"open_issues_count":37,"forks_count":90,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-07-09T08:04:50.792Z","etag":null,"topics":["react","selectable","selectbox"],"latest_commit_sha":null,"homepage":"https://react-selectable-fast.now.sh","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/valerybugakov.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.hbs","contributing":null,"funding":null,"license":"LICENSE","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":"2016-03-01T11:15:33.000Z","updated_at":"2025-05-22T07:42:06.000Z","dependencies_parsed_at":"2024-06-18T13:43:03.271Z","dependency_job_id":"2cf47611-db2f-491a-ad4a-eb0dd8a8b54c","html_url":"https://github.com/valerybugakov/react-selectable-fast","commit_stats":{"total_commits":148,"total_committers":15,"mean_commits":9.866666666666667,"dds":"0.17567567567567566","last_synced_commit":"b31d776a3805185d6ddb9d32d6eeb133b2492d4e"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/valerybugakov/react-selectable-fast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valerybugakov%2Freact-selectable-fast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valerybugakov%2Freact-selectable-fast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valerybugakov%2Freact-selectable-fast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valerybugakov%2Freact-selectable-fast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valerybugakov","download_url":"https://codeload.github.com/valerybugakov/react-selectable-fast/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valerybugakov%2Freact-selectable-fast/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264926332,"owners_count":23684320,"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":["react","selectable","selectbox"],"created_at":"2024-10-12T01:38:08.558Z","updated_at":"2025-07-12T02:40:08.275Z","avatar_url":"https://github.com/valerybugakov.png","language":"TypeScript","readme":"# React-selectable-fast ![npm](https://img.shields.io/npm/v/react-selectable-fast.svg) ![license](https://img.shields.io/npm/l/react-selectable-fast.svg)\n\nEnable a React component (or group of components) to be selectable via mouse/touch.\n\n## Demo\n\nhttps://react-selectable-fast.now.sh\n\n## Install\n\n```sh\nnpm i -S react-selectable-fast\n```\n\n[![react-selectable-fast](https://nodei.co/npm/react-selectable-fast.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/react-selectable-fast/)\n\n## Based on react-selectable\n\nThis project is based on [react-selectable](https://github.com/unclecheese/react-selectable) by [unclecheese](https://github.com/unclecheese).\nThe main idea of this fork is to eliminate render during selection caused by state updates of SelectableGroup. Only items under selectbox rerender themselves, which great for big lists of selectable items. Also, this package extends the original functionality with ability to scroll items while selecting relative to window and specified scroll container.\n\n## Usage\n\nPackage exports 5 entities\n\n```ts\nexport { TSelectableItemProps, SelectableGroup, createSelectable, SelectAll, DeselectAll }\n```\n\nTo make other components selectable wrap them using HoC `createSelectable`, add passed `selectableRef` prop to the target node and put a list of seletable items under `SelectableGroup`.\n\n```ts\nimport React, { Component } from 'react'\nimport { SelectableGroup } from 'react-selectable-fast'\n\nclass App extends Component {\n  ...\n\n  render() {\n    return (\n      \u003cSelectableGroup\n        className=\"main\"\n        clickClassName=\"tick\"\n        enableDeselect\n        tolerance={this.state.tolerance}\n        globalMouse={this.state.isGlobal}\n        allowClickWithoutSelected={false}\n        duringSelection={this.handleSelecting}\n        onSelectionClear={this.handleSelectionClear}\n        onSelectionFinish={this.handleSelectionFinish}\n        onSelectedItemUnmount={this.handleSelectedItemUnmount}\n        ignoreList={['.not-selectable', '.item:nth-child(10)', '.item:nth-child(27)']}\n      \u003e\n        \u003cList items={this.props.items} /\u003e\n      \u003c/SelectableGroup\u003e\n    )\n  }\n}\n```\n\n```ts\nimport React from 'react'\nimport { TSelectableItemProps, createSelectable } from 'react-selectable-fast'\n\nclass SomeComponent extends Component\u003cTSelectableItemProps\u003e {\n  render() {\n    const { selectableRef, isSelected, isSelecting } = this.props\n\n    return \u003cdiv ref={selectableRef}\u003e...\u003c/div\u003e\n  }\n}\n\nexport default createSelectable(SomeComponent)\n```\n\n```ts\nimport React from 'react'\nimport { SelectAll, DeselectAll } from 'react-selectable-fast'\nimport SelectableComponent from './SomeComponent'\n\nconst List = () =\u003e (\n  \u003cdiv\u003e\n    \u003cSelectAll className=\"selectable-button\"\u003e\n      \u003cbutton\u003eSelect all\u003c/button\u003e\n    \u003c/SelectAll\u003e\n    \u003cDeselectAll className=\"selectable-button\"\u003e\n      \u003cbutton\u003eClear selection\u003c/button\u003e\n    \u003c/DeselectAll\u003e\n    {this.props.items.map((item, i) =\u003e (\n      \u003cSelectableComponent key={i} player={item.player} year={item.year} /\u003e\n    ))}\n  \u003c/div\u003e\n)\n```\n\n## JavaScript environment requirements\n\nThe React-Selectable-Fast package distributed on NPM use the widely-supported ES5\nversion of JavaScript to support as many browser environments as possible.\n\nHowever, this package expects modern JavaScript globals (`Map`, `Set`,\n`Array.from`, `Array.isArray` `Object.assign`) to be defined. If you support older browsers and\ndevices which may not yet provide these natively, consider including a global\npolyfill in your bundled application, such as [core-js](https://github.com/zloirock/core-js) or\n[babel-polyfill](https://babeljs.io/docs/usage/polyfill/).\n\nA polyfilled environment for React-Selectable-Fast using [core-js](https://github.com/zloirock/core-js) to support older browsers\nmight look like this:\n\n```ts\nimport 'core-js/fn/object/assign'\nimport 'core-js/fn/array/from'\nimport 'core-js/fn/array/is-array'\nimport 'core-js/fn/map'\nimport 'core-js/fn/set'\n\nimport App from './myApp'\n```\n\n## Configuration\n\nThe `\u003cSelectableGroup /\u003e` component accepts a few optional props:\n\n- `duringSelection` (Function) Callback fired rapidly during selection (while the selector is being dragged). Passes an array containing selectable items currently under the selector to the callback function.\n- `onSelectionFinish` (Function) Callback.\n- `onSelectionClear` (Function) Callback.\n- `onSelectedItemUnmount` (Function) Callback.\n- `enableDeselect` (Boolean) Enables deselect with selectbox.\n- `mixedDeselect` (Boolean) When enabled items can be selected and deselected with selectbox at the same time, `enableDeselect` should be set to `true`.\n- `scrollContainer` (String) Selector of scroll container which will be used to calculate selectbox position. If not specified SelectableGroup element will be used as scroll container.\n- `ignoreList` (Array) Array of ignored selectors.\n- `clickableClassName` (String) On elements with specified selector click item containing this element will be selected.\n- `tolerance` (Number) The amount of buffer to add around your `\u003cSelectableGroup /\u003e` container, in pixels.\n- `className` (String) Class of selectable group element.\n- `selectionModeClass` (String) Class indicating that there is more than 1 selected item. Defaults to 'in-selection-mode'.\n- `selectboxClassName` (String) Class of selectbox element.\n- `component` (String) The component to render. Defaults to `div`.\n- `allowClickWithoutSelected` (Boolean) When disabled items can be selected by click only if there is more than 1 already selected item.\n- `fixedPosition` (Boolean) Whether the `\u003cSelectableGroup /\u003e` container is a fixed or absolutely positioned element or the grandchild of one.\n- `resetOnStart` (Boolean) Unselect all items when you start a new drag. Default value is `false`.\n- `deselectOnEsc` (Boolean) Unselect all items on ESC keydown/keyup events. Default value is `true`. Using `ref` on `SelectableGroup` gives access to `ref.clearSelection()` method to unselect all items programmatically.\n- `disabled` (Boolean) Enable or disable the selectable draggable, useful if you want to enable drag of sub-items. Default value is `false`.\n- `delta` (Number) Value of the CSS transform property scaled list, useful if your list of items in `\u003cSelectableGroup /\u003e` is wrapped by a scale css transform property. Default value is `1`.\n- `selectOnClick` (Boolean) Allow selecting by clicking items. Default value is `true`\n- `allowAltClick` (Boolean) Perform select actions even though the `alt` key is down when clicking or dragging. Default value is `false`\n- `allowCtrlClick` (Boolean) Perform select actions even though the `ctrl` key is down when clicking or dragging. Default value is `false`\n- `allowMetaClick` (Boolean) Perform select actions even though the `meta` key is down when clicking or dragging. Default value is `false`\n- `allowShiftClick` (Boolean) Perform select actions even though the `shift` key is down when clicking or dragging. Default value is `false`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalerybugakov%2Freact-selectable-fast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalerybugakov%2Freact-selectable-fast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalerybugakov%2Freact-selectable-fast/lists"}