Documentation Index
Fetch the complete documentation index at: https://mintlify.com/rijvi-mahmud/shaddy/llms.txt
Use this file to discover all available pages before exploring further.
DateRangePicker is an enhanced calendar component built on top of the shadcn/ui Calendar, Popover, and Button primitives. It renders a trigger button that opens a popover containing a two-month calendar view alongside a list of built-in preset ranges — such as Today, Last 7 Days, This Month, and more. Users can pick a preset for instant selection or click individual days for a fully custom date range. An inline clear button lets them reset their selection without re-opening the picker.
Installation
Install manually — dependencies
If you prefer to install by hand, start with the required npm packages:
Usage
Without presets
PassshowInternalPresets={false} to display only the calendar, hiding the preset sidebar:
Pre-populated with a day count
Use thedayCount prop to initialize the picker with a rolling window ending today — useful for dashboards that open with a default “last N days” selection:
Props
The currently selected date range. Pass
from and/or to dates to control the component externally. When both are defined the trigger button displays the formatted range.Number of days to use for the default range, counting back from today. For example,
dayCount={7} initialises the picker to the last 7 days. Ignored when dateRange is provided.Placeholder text rendered inside the trigger button when no date range is selected.
Visual style variant of the trigger button. Maps to the shadcn/ui
Button variant prop (excluding "destructive" and "link").Size of the trigger button. Maps to the shadcn/ui
Button size prop (excluding "icon").Additional CSS class names applied to the trigger button element.
Callback invoked when the user confirms a date range. Called on preset click (immediately) or when the user presses the OK button after making a calendar selection.
When
true, a sidebar of built-in preset ranges is displayed alongside the calendar. Set to false to show only the calendar.DateRangePicker also forwards all props accepted by shadcn/ui’s PopoverContent (except onChange), so you can control alignment, side offset, collision padding, and more.Built-in preset ranges
The following presets are available by default whenshowInternalPresets is true:
| Preset | Range |
|---|---|
| Today | Current day |
| Yesterday | Previous day |
| This Week | Monday → Sunday of current week |
| Last Week | Monday → Sunday of previous week |
| Last 7 Days | 6 days ago → today |
| This Month | First → last day of current month |
| Last Month | First → last day of previous month |
| This Year | Jan 1 → Dec 31 of current year |
| Last Year | Jan 1 → Dec 31 of previous year |