{"id":19015690,"url":"https://github.com/fatihcaliss/shadcn-time-range-picker","last_synced_at":"2025-04-23T01:50:16.977Z","repository":{"id":252769638,"uuid":"841221638","full_name":"fatihcaliss/shadcn-time-range-picker","owner":"fatihcaliss","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-18T10:23:20.000Z","size":32067,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T01:50:03.115Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/fatihcaliss.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":"2024-08-12T00:44:30.000Z","updated_at":"2025-04-19T22:58:21.000Z","dependencies_parsed_at":"2024-11-08T19:51:10.870Z","dependency_job_id":null,"html_url":"https://github.com/fatihcaliss/shadcn-time-range-picker","commit_stats":null,"previous_names":["fatihcaliss/shadcn-time-range-picker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fatihcaliss%2Fshadcn-time-range-picker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fatihcaliss%2Fshadcn-time-range-picker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fatihcaliss%2Fshadcn-time-range-picker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fatihcaliss%2Fshadcn-time-range-picker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fatihcaliss","download_url":"https://codeload.github.com/fatihcaliss/shadcn-time-range-picker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250354294,"owners_count":21416751,"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":[],"created_at":"2024-11-08T19:39:16.487Z","updated_at":"2025-04-23T01:50:16.961Z","avatar_url":"https://github.com/fatihcaliss.png","language":"TypeScript","funding_links":[],"categories":["Components \u0026 Libraries"],"sub_categories":[],"readme":"# TimeRangePicker\n\nA flexible and customizable time range picker component built with React and shadcn/ui. This component allows users to select a start and end time from a list of predefined time options, with extensive customization options.\n\n\u003cimg src=\"https://github.com/fatihcaliss/shadcn-time-range-picker/blob/master/time-range-picker-preview.gif?raw=true\" alt=\"Package Preview\" height=\"300\"\u003e\n\n## Features\n\n- Select start and end times from a predefined list.\n- Optional automatic sorting of start and end times.\n- Customizable initial start and end times.\n- Adjustable time step for generating time options.\n- Optional Apply button with full customization support.\n- Flexible layout options (row or column).\n- Customizable labels and placeholders for start and end time selects.\n- Built with shadcn/ui components for a consistent and elegant UI.\n- TypeScript support for improved type safety and developer experience.\n- Improved button customization with full support for shadcn/ui Button props.\n\n## Installation\n\nYou can install the `TimeRangePicker` package via npm:\n\n```bash\nnpm install shadcn-time-range-picker\n```\n\n## GitHub Repository\n\n```\nhttps://github.com/fatihcaliss/shadcn-time-range-picker\n```\n\n## Usage\n\nHere's a simple example of how to use the TimeRangePicker component in your React application:\n\n```tsx\nimport React from \"react\";\nimport TimeRangePicker from \"shadcn-time-range-picker\";\n\nconst App = () =\u003e {\n  const handleTimeRangeChange = (timeRange: string) =\u003e {\n    console.log(`Selected time range: ${timeRange}`);\n  };\n\n  return (\n    \u003cdiv\u003e\n      \u003ch1\u003eSelect a Time Range\u003c/h1\u003e\n      \u003cTimeRangePicker\n        initialStartTime=\"08:00\"\n        initialEndTime=\"17:00\"\n        onTimeRangeChange={handleTimeRangeChange}\n        sort={true}\n        showApplyButton={true}\n        layout=\"row\"\n        startTimeLabel=\"Work Start\"\n        endTimeLabel=\"Work End\"\n        step={15}\n        buttonProps={{\n          variant: \"outline\",\n          className: \"font-semibold\",\n        }}\n      /\u003e\n    \u003c/div\u003e\n  );\n};\n\nexport default App;\n```\n\n## Props\n\nThe TimeRangePicker component accepts the following props:\n\n| Prop                 | Type                        | Default             | Description                                                     |\n| -------------------- | --------------------------- | ------------------- | --------------------------------------------------------------- |\n| initialStartTime     | string                      | \"00:00\"             | The initial start time.                                         |\n| initialEndTime       | string                      | \"23:30\"             | The initial end time.                                           |\n| onTimeRangeChange    | (timeRange: string) =\u003e void | undefined           | Callback function that gets called when the time range changes. |\n| sort                 | boolean                     | false               | If true, automatically sorts the start and end times.           |\n| showApplyButton      | boolean                     | true                | If true, shows the Apply button.                                |\n| layout               | 'row' \\| 'column'           | 'row'               | Layout of the component (row or column).                        |\n| startTimeLabel       | string                      | \"Start Time\"        | Label for the start time select.                                |\n| endTimeLabel         | string                      | \"End Time\"          | Label for the end time select.                                  |\n| startTimePlaceholder | string                      | \"Select start time\" | Placeholder for the start time select.                          |\n| endTimePlaceholder   | string                      | \"Select end time\"   | Placeholder for the end time select.                            |\n| step                 | number                      | 30                  | Time step in minutes for generating time options.               |\n| applyButtonText      | string                      | \"Apply\"             | Button text                                                     |\n| buttonProps          | ButtonProps                 | undefined           | Props to customize the Apply button (shadcn/ui Button props)    |\n| labelClassName       | string                      | undefined           | CSS class(es) to apply to the label elements                    |\n\n## Example Usage\n\n### Basic Usage\n\n```tsx\n\u003cTimeRangePicker\n  initialStartTime=\"08:00\"\n  initialEndTime=\"17:00\"\n  onTimeRangeChange={(timeRange) =\u003e console.log(timeRange)}\n  sort={true}\n/\u003e\n```\n\n### Advanced Usage with Customizations\n\n```tsx\n\u003cTimeRangePicker\n  initialStartTime=\"09:00\"\n  initialEndTime=\"18:00\"\n  onTimeRangeChange={(timeRange) =\u003e console.log(timeRange)}\n  sort={true}\n  showApplyButton={true}\n  layout=\"column\"\n  startTimeLabel=\"Shift Start\"\n  endTimeLabel=\"Shift End\"\n  startTimePlaceholder=\"Select shift start\"\n  endTimePlaceholder=\"Select shift end\"\n  step={15}\n  labelClassName=\"text-primary font-bold\"\n  buttonProps={{\n    variant: \"secondary\",\n    size: \"sm\",\n    className: \"font-bold text-primary\",\n  }}\n/\u003e\n```\n\n## Button Customization\n\nThe `buttonProps` prop allows full customization of the Apply button using shadcn/ui Button component props. This includes setting the variant, size, and adding custom classes. For example:\n\n```tsx\n\u003cTimeRangePicker\n  // ... other props\n  buttonProps={{\n    variant: \"outline\",\n    size: \"sm\",\n    className: \"font-semibold text-primary hover:bg-primary/10\",\n  }}\n/\u003e\n```\n\n## Responsive Design\n\nThe TimeRangePicker component is designed to be responsive. When the `layout` prop is set to \"row\", it will automatically switch to a column layout on smaller screens for better mobile user experience.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests.\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffatihcaliss%2Fshadcn-time-range-picker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffatihcaliss%2Fshadcn-time-range-picker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffatihcaliss%2Fshadcn-time-range-picker/lists"}