{"id":13393230,"url":"https://github.com/daybrush/selecto","last_synced_at":"2025-05-13T22:06:40.571Z","repository":{"id":38214744,"uuid":"230653885","full_name":"daybrush/selecto","owner":"daybrush","description":"Selecto.js is a component that allows you to select elements in the drag area using the mouse or touch.","archived":false,"fork":false,"pushed_at":"2024-06-17T18:43:06.000Z","size":29358,"stargazers_count":2124,"open_issues_count":92,"forks_count":89,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-05-07T18:51:47.265Z","etag":null,"topics":["angular","lit","moveable","react","scena","scenejs","select","selectable","selection","selecto","svelte","vue"],"latest_commit_sha":null,"homepage":"https://daybrush.com/selecto","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/daybrush.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"daybrush","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2019-12-28T19:16:33.000Z","updated_at":"2025-05-07T09:06:17.000Z","dependencies_parsed_at":"2023-02-12T09:16:01.475Z","dependency_job_id":"a1af111f-e687-4559-b4b2-ff48921e8e18","html_url":"https://github.com/daybrush/selecto","commit_stats":{"total_commits":395,"total_committers":10,"mean_commits":39.5,"dds":"0.28101265822784816","last_synced_commit":"7c75ef57790ffc197afdab0f49127ce38d3707b9"},"previous_names":[],"tags_count":245,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daybrush%2Fselecto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daybrush%2Fselecto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daybrush%2Fselecto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daybrush%2Fselecto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daybrush","download_url":"https://codeload.github.com/daybrush/selecto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253568621,"owners_count":21928903,"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":["angular","lit","moveable","react","scena","scenejs","select","selectable","selection","selecto","svelte","vue"],"created_at":"2024-07-30T17:00:46.827Z","updated_at":"2025-05-13T22:06:35.550Z","avatar_url":"https://github.com/daybrush.png","language":"TypeScript","readme":"\n\u003cp align=\"middle\" \u003e\u003cimg src=\"https://daybrush.com/selecto/images/logo.png\" /\u003e\u003c/p\u003e\n\u003ch2 align=\"middle\"\u003eSelecto.js\u003c/h2\u003e\n\u003cp align=\"middle\"\u003e\n\u003ca href=\"https://www.npmjs.com/package/selecto\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/selecto.svg?style=flat-square\u0026color=007acc\u0026label=version\" alt=\"npm version\" /\u003e\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/badge/language-typescript-blue.svg?style=flat-square\"/\u003e\n\u003ca href=\"https://github.com/daybrush/selecto/blob/master/LICENSE\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/github/license/daybrush/selecto.svg?style=flat-square\u0026label=license\u0026color=08CE5D\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daybrush/selecto/tree/master/packages/react-selecto\" target=\"_blank\"\u003e\u003cimg alt=\"React\" src=\"https://img.shields.io/static/v1.svg?label=\u0026message=React\u0026style=flat-square\u0026color=61daeb\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daybrush/selecto/tree/master/packages/preact-selecto\" target=\"_blank\"\u003e\u003cimg alt=\"Preact\" src=\"https://img.shields.io/static/v1.svg?label=\u0026message=Preact\u0026style=flat-square\u0026color=673ab8\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daybrush/selecto/tree/master/packages/ngx-selecto\" target=\"_blank\"\u003e\u003cimg alt=\"Angular\" src=\"https://img.shields.io/static/v1.svg?label=\u0026message=Angular\u0026style=flat-square\u0026color=C82B38\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daybrush/selecto/tree/master/packages/vue-selecto\" target=\"_blank\"\u003e\u003cimg\n    alt=\"Vue\"\n    src=\"https://img.shields.io/static/v1.svg?label=\u0026message=Vue2\u0026style=flat-square\u0026color=3fb984\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daybrush/selecto/tree/master/packages/vue3-selecto\" target=\"_blank\"\u003e\u003cimg\n    alt=\"Vue\"\n    src=\"https://img.shields.io/static/v1.svg?label=\u0026message=Vue3\u0026style=flat-square\u0026color=3fb984\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daybrush/selecto/tree/master/packages/svelte-selecto\" target=\"_blank\"\u003e\u003cimg\n    alt=\"Svelte\"\n    src=\"https://img.shields.io/static/v1.svg?label=\u0026message=Svelte\u0026style=flat-square\u0026color=C82B38\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/daybrush/selecto/tree/master/packages/lit-selecto\" target=\"_blank\"\u003e\u003cimg\n    alt=\"Lit\"\n    src=\"https://img.shields.io/static/v1.svg?label=\u0026message=Lit\u0026style=flat-square\u0026color=4E8EE0\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"middle\"\u003eSelecto.js is a component that allows you to select elements in the drag area using the mouse or touch.\u003c/p\u003e\n\n\u003cp align=\"middle\"\u003e\n    \u003ca href=\"https://daybrush.com/selecto\" target=\"_blank\"\u003e\u003cstrong\u003eDemo\u003c/strong\u003e\u003c/a\u003e /\n    \u003ca href=\"https://daybrush.com/selecto/release/latest/doc/\" target=\"_blank\"\u003e\u003cstrong\u003eAPI\u003c/strong\u003e\u003c/a\u003e /\n    \u003ca href=\"https://github.com/daybrush/scena\" target=\"_blank\"\u003e\u003cstrong\u003eMain Project\u003c/strong\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## ⚙️ Installation\n### npm\n```bash\n$ npm install selecto\n```\n\n### scripts\n\n```html\n\u003cscript src=\"//daybrush.com/selecto/release/latest/dist/selecto.min.js\"\u003e\u003c/script\u003e\n```\n\n## 🚀 How to use\n\n### Option Behaviors\n* If you want to prevent select from inside and no click\n    * selectFromInside: false\n    * selectByClick: false (default)\n* If you want to include it regardless of hitTest when selecting from the inside\n    * selectFromInside: true (default)\n    * selectByClick: true\n* If you want to finish right away (selectStart and selectEnd occur at the same time) without dragging when selecting from inside\n    * selectFromInside: false\n    * selectByClick: true\n    * preventDragFromInside: true (default)\n    * clickBySelectEnd: false (default)\n* If you want to selectEnd(click) after stopping drag and mouse(touch)\n    * selectFromInside: false\n    * selectByClick: true\n    * clickBySelectEnd: true\n\n```js\nimport Selecto from \"selecto\";\n\nconst selecto = new Selecto({\n    // The container to add a selection element\n    container: document.body,\n    // Selecto's root container (No transformed container. (default: null)\n    rootContainer: null,\n    // The area to drag selection element (default: container)\n    dragContainer: Element,\n    // Targets to select. You can register a queryselector or an Element.\n    selectableTargets: [\".target\", document.querySelector(\".target2\")],\n    // Whether to select by click (default: true)\n    selectByClick: true,\n    // Whether to select from the target inside (default: true)\n    selectFromInside: true,\n    // After the select, whether to select the next target with the selected target (deselected if the target is selected again).\n    continueSelect: false,\n    // Determines which key to continue selecting the next target via keydown and keyup.\n    toggleContinueSelect: \"shift\",\n    // The container for keydown and keyup events\n    keyContainer: window,\n    // The rate at which the target overlaps the drag area to be selected. (default: 100)\n    hitRate: 100,\n});\n\nselecto.on(\"select\", e =\u003e {\n    e.added.forEach(el =\u003e {\n        el.classList.add(\"selected\");\n    });\n    e.removed.forEach(el =\u003e {\n        el.classList.remove(\"selected\");\n    });\n});\n```\n### Do you want to select accurately?\nSince `selecto` basically checks using getBoundingClientRect, it is not accurate if the object is rotated or distorted.\n\nIf you want to check accurately, use `getElementRect` option with the following code\n\n* [See Example](https://daybrush.com/selecto/storybook/?path=/story/selecto--select-accurately)\n\n```ts\nimport Selecto from \"selecto\";\nimport { getElementInfo } from \"moveable\"; // (13kb function) if you use react, use react-moveable\n\nconst selecto = new Selecto({\n    ...,\n    // (target: HTMLElement | SVGElement ) =\u003e { pos1: number[], pos2: number[], pos3: number[], pos4: number[] }\n    // pos1: left top\n    // pos2: right top\n    // pos3: left bottom\n    // pos4: right bottom\n    getElementRect: getElementInfo,\n});\n```\n\n## 📦 Packages\n|Package\u0026nbsp;Name|\u0026nbsp;Version\u0026nbsp;|Description|\n|---|---|---|\n|[**react-selecto**](https://github.com/daybrush/selecto/tree/master/packages/react-selecto)|[![](https://img.shields.io/npm/v/react-selecto.svg?style=flat-square)](https://npmjs.com/package/react-selecto)|A React Selecto Component that allows you to select elements in the drag area using the mouse or touch.|\n|[**ngx-selecto**](https://github.com/daybrush/selecto/tree/master/packages/ngx-selecto)|[![](https://img.shields.io/npm/v/ngx-selecto.svg?style=flat-square)](https://npmjs.com/package/ngx-selecto)|An Angular Selecto Component that allows you to select elements in the drag area using the mouse or touch.|\n|[**vue-selecto**](https://github.com/daybrush/selecto/tree/master/packages/vue-selecto)|[![](https://img.shields.io/npm/v/vue-selecto.svg?style=flat-square)](https://npmjs.com/package/vue-selecto)|A Vue 2 Selecto Component that allows you to select elements in the drag area using the mouse or touch.|\n|[**vue3-selecto**](https://github.com/daybrush/selecto/tree/master/packages/vue3-selecto)|[![](https://img.shields.io/npm/v/vue3-selecto.svg?style=flat-square)](https://npmjs.com/package/vue-selecto)|A Vue 3 Selecto Component that allows you to select elements in the drag area using the mouse or touch.|\n|[**preact-selecto**](https://github.com/daybrush/selecto/tree/master/packages/preact-selecto)|[![](https://img.shields.io/npm/v/preact-selecto.svg?style=flat-square)](https://npmjs.com/package/preact-selecto)|A Preact Selecto Component that allows you to select elements in the drag area using the mouse or touch.|\n|[**svelte-selecto**](https://github.com/daybrush/selecto/tree/master/packages/svelte-selecto)|[![](https://img.shields.io/npm/v/svelte-selecto.svg?style=flat-square)](https://npmjs.com/package/svelte-selecto)|A Svelte Selecto Component that allows you to select elements in the drag area using the mouse or touch.|\n|[**lit-selecto**](https://github.com/daybrush/selecto/tree/master/packages/lit-selecto)|[![](https://img.shields.io/npm/v/lit-selecto.svg?style=flat-square)](https://npmjs.com/package/lit-selecto)|A Lit Selecto Component that allows you to select elements in the drag area using the mouse or touch.|\n\n\n## ⭐️ Show Your Support\nPlease give a ⭐️ if this project helped you!\n\n## 👏 Contributing\n\nIf you have any questions or requests or want to contribute to `selecto` or other packages, please write the [issue](https://github.com/daybrush/selecto/issues) or give me a Pull Request freely.\n\n## 🐞 Bug Report\n\nIf you find a bug, please report to us opening a new [Issue](https://github.com/daybrush/selecto/issues) on GitHub.\n\n\n## 📝 License\n\nThis project is [MIT](https://github.com/daybrush/selecto/blob/master/LICENSE) licensed.\n\n```\nMIT License\n\nCopyright (c) 2020 Daybrush\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","funding_links":["https://github.com/sponsors/daybrush"],"categories":["HTML","TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaybrush%2Fselecto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaybrush%2Fselecto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaybrush%2Fselecto/lists"}