{"id":23283557,"url":"https://github.com/lerrybe/react-draggable-selector","last_synced_at":"2026-03-07T22:07:30.182Z","repository":{"id":185193525,"uuid":"672985787","full_name":"lerrybe/react-draggable-selector","owner":"lerrybe","description":"🖱 Component for select times with drag action in React","archived":false,"fork":false,"pushed_at":"2023-08-24T09:56:33.000Z","size":782,"stargazers_count":18,"open_issues_count":3,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-22T20:41:54.465Z","etag":null,"topics":["drag","react","selector"],"latest_commit_sha":null,"homepage":"https://react-draggable-selector.vercel.app","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/lerrybe.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2023-07-31T15:52:57.000Z","updated_at":"2025-08-16T20:59:48.000Z","dependencies_parsed_at":"2024-12-20T01:33:17.221Z","dependency_job_id":null,"html_url":"https://github.com/lerrybe/react-draggable-selector","commit_stats":null,"previous_names":["lerrybe/react-draggable-selector"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/lerrybe/react-draggable-selector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lerrybe%2Freact-draggable-selector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lerrybe%2Freact-draggable-selector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lerrybe%2Freact-draggable-selector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lerrybe%2Freact-draggable-selector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lerrybe","download_url":"https://codeload.github.com/lerrybe/react-draggable-selector/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lerrybe%2Freact-draggable-selector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30233432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T19:01:10.287Z","status":"ssl_error","status_checked_at":"2026-03-07T18:59:58.103Z","response_time":53,"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":["drag","react","selector"],"created_at":"2024-12-20T01:22:26.557Z","updated_at":"2026-03-07T22:07:29.903Z","avatar_url":"https://github.com/lerrybe.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🖍 React-Draggable-Selector\n\n\u003cimg src=\"https://user-images.githubusercontent.com/71599639/262469722-eaed6334-1a1f-446b-9078-749773e852e1.png\" alt=\"intro\" style=\"width: 700px\" /\u003e\n\n\n### Select with a simple drag!\n\nReact-Draggable-Selector is a react component that allows users to easily select time ranges by dragging.\n\nThis package is for react applications, and uses [@emotion](https://emotion.sh/docs/introduction) for styling and [dayjs](https://www.npmjs.com/package/dayjs) for date and time management. Its main advantages are its intuitive drag-to-select functionality. You can select a time zone by day of the week or by date. Let's get started!\n\n# Live example \u0026 Document \n[Go Live Example](https://react-draggable-selector.vercel.app/)\n\nYou can learn how to use it directly in the document.\n\n\n# 🚀 Quick Start\n\n## **1. Installation**\n\nUse npm package manager to install\n\n```bash\n$ npm install react-draggable-selector\n```\n\nor install with yarn\n\n```bash\n$ yarn add react-draggable-selector\n```\n\n## **2. Usage**\nTake out the component in your React project.\n\n### 1. When using Javascript:\n\n```jsx\nimport { useState } from 'react';\nimport { DraggableSelector } from \"react-draggable-selector\";\n\nfunction App () {\n  const [dates, setDates] = useState([]);  // Should inject sorted, not duplicated Date[]\n  const [times, setTimes] = useState([]);\n\n  return (\n    \u003cDraggableSelector\n      minTime={9}              // required\n      maxTime={14}             // required\n      dates={dates}            // required, required default: []\n      timeSlots={times}        // required, required default: []\n      setTimeslots={setTimes}  // required\n    /\u003e\n  );\n};\n\nexport default App;\n```\n\n### 2. When using Typescript:\n\n```tsx\nimport { useState } from 'react';\nimport { DraggableSelector, TimeSlot } from \"react-draggable-selector\";\n\n/*\ninterface TimeSlot {\n  day: number;\n  date: string;\n  minTime: string;  // '09:00', '14:00'\n  maxTime: string;  // '09:30', '14:30'\n}\n*/\n\nfunction App () {\n  const [dates, setDates] = useState\u003cDate[]\u003e([]);  // Should inject sorted, not duplicated Date[]\n  const [times, setTimes] = useState\u003cTimeSlot[]\u003e([]);\n\n  return (\n    \u003cDraggableSelector\n      minTime={9}              // required, type: 'number'\n      maxTime={14}             // required, type: 'number'\n      dates={dates}            // required, type: 'Date[]', required default: []\n      timeSlots={times}        // required, type: 'TimeSlot[]', required default: []\n      setTimeslots={setTimes}  // required, type: 'React.Dispatch\u003cReact.SetStateAction\u003cTimeSlot[]\u003e\u003e'\n    /\u003e\n  );\n};\n\nexport default App;\n```\n\n## **3. Props**\n\n### **3.1. Required Props**\n\n| Name (Prop)  | Type                                             | Description                                                                                                   | Default value | Required |\n|--------------|--------------------------------------------------|---------------------------------------------------------------------------------------------------------------|---------------|----------|\n| dates        | Date[]                                           | Selected dates, you can making a selection for that date. Required default value is `[]`                      | -             | ✔️       |\n| minTime      | number                                           | The start time to display. Type it in 24-hour notation and write it as follows, `9`                           | -             | ✔️       |\n| maxTime      | number                                           | The last time to display. Type it in 24-hour notation and write it as follows, `18`                           | -             | ✔️       |\n| timeSlots    | TimeSlot[]                                       | Array of selected time cells. You can also convert the information from output into a Date object and use it. | -             | ✔️       |\n| setTimeSlots | React.Dispatch\u003cReact.SetStateAction\u003cTimeSlot[]\u003e\u003e | The setState function of the selectedTimeSlots.                                                               | -             | ✔️       |\n\n\n### **3.2. Optional Props**\n\n| Name (Prop)                | Type                            | Description                                                                                                                                                                                              | Default value       | Required |\n|----------------------------|---------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------|----------|\n| timeUnit                   | 5 \\| 10 \\| 15 \\| 20 \\| 30 \\| 60 | The time interval for the selector. The amount of time a cell has.                                                                                                                                       | 30                  |          | \n| dateFormat                 | string                          | Use the date format method of dayjs. You can use the following link to set the formatting form. (https://day.js.org/docs/en/display/format)                                                              | 'M.D'               |          |\n| timeFormat                 | string                          | Use the time format method of dayjs. You can use the following link to set the formatting form. (https://day.js.org/docs/en/display/format)                                                              | 'HH:mm A'           |          |\n| mode                       | 'date' \\| 'day'                 | Decide whether to indicate all dates or by day of the week. (In the `day` version) If there is no day of the week corresponding to the selected date, the cell is blocked so that it cannot be selected. | 'day'               |          |\n| slotWidth                  | number                          | The width of each slot. Assign the value in `number`.                                                                                                                                                    | 62                  |          |\n| slotHeight                 | number                          | The height of each slot. Assign the value in `number`.                                                                                                                                                   | 18                  |          |\n| slotsMarginTop             | number                          | The margin-top of slots container. Assign the value in `number`.                                                                                                                                         | 11                  |          |\n| slotsMarginLeft            | number                          | The margin-left of slots container. Assign the value in `number`.                                                                                                                                        | 20                  |          |\n| maxWidth                   | string                          | The max-width of selector. Assign the value in `string`. e.g. `536px`                                                                                                                                    | '546px'             |          |\n| maxHeight                  | string                          | The max-height of selector. Assign the value in `string`. e.g. `452px`, `100%`                                                                                                                           | '452px'             |          |\n| defaultSlotColor           | string                          | The default color of each slot. Assign the value in `string`. e.g. `#FFFFFF`                                                                                                                             | '#FFFFFF'           |          |\n| selectedSlotColor          | string                          | The color of each slot when it is selected. Assign the value in `string`. e.g. `#FFF5E5`                                                                                                                 | '#b3c6d3'           |          |\n| disabledSlotColor          | string                          | The color of each slot when it is disabled. Assign the value in `string`. e.g. `#e1e1e1`                                                                                                                 | '#e1e1e1'           |          |\n| hoveredSlotColor           | string                          | The color of each slot when it is hovered. Assign the value in `string`. e.g. `#FFF5E5`                                                                                                                  | '#eef2f6'           |          |\n| slotsContainerBorder       | string                          | The border of slots container. Assign the value in `string`. e.g. `1px solid #8c8d94`                                                                                                                    | '1px solid #8c8d94' |          |\n| slotsContainerBorderRadius | string                          | The border-radius of slots container. Assign the value in `string`. e.g. `0px`, `5px`                                                                                                                    | '0px'               |          |\n\n\n# License\nThe MIT License.\n\n# Contribution \u0026 Issues \u0026 Bug report\n\nAlways welcome! \nI would appreciate it if you could leave it as an issue in the repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flerrybe%2Freact-draggable-selector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flerrybe%2Freact-draggable-selector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flerrybe%2Freact-draggable-selector/lists"}