byun-daterange-picker
GitHub

Byun DateRange Picker

A copy-paste React date range picker with presets, optional time and timezone inputs, and 3-click range selection. This demo page focuses on practical usage and API details in a document-first layout.

  • Preset sidebar with customizable preset definitions
  • Optional time and timezone controls
  • Controlled and uncontrolled usage patterns
  • Accessible defaults with keyboard support

Live demo

Full picker with time, timezone, and no-date-range mode enabled.

No value applied yet.

Quick start

Prerequisites: Node.js 20+ and pnpm 10+.

This is a copy-paste component, not an npm package. Copy the files below into your project and install the dependencies.

1. Clone and copy required files

git clone https://github.com/hyunghwan/byun-daterange-picker.git
cd byun-daterange-picker
  • components/ui/super-date-range-picker.tsx
  • components/ui/calendar.tsx
  • components/ui/button.tsx
  • components/ui/popover.tsx
  • components/ui/command.tsx
  • components/ui/dialog.tsx
  • components/ui/input.tsx
  • components/ui/separator.tsx
  • components/ui/switch.tsx
  • lib/utils.ts

2. Install dependencies

pnpm add date-fns react-day-picker lucide-react cmdk \
  @radix-ui/react-popover @radix-ui/react-dialog \
  @radix-ui/react-separator @radix-ui/react-switch \
  @radix-ui/react-slot class-variance-authority \
  clsx tailwind-merge

3. Use in your app

import { SuperDateRangePicker } from "@/components/ui/super-date-range-picker";

export default function App() {
  return <SuperDateRangePicker onApply={(range) => console.log(range)} />;
}

Examples

Core examples are shown by default. Advanced variants are grouped in a collapsed section.

Default

Preset sidebar + 2-month calendar with Apply commit.

No value applied yet.

Time + timezone

Enable both time inputs and timezone selector.

No value applied yet.

Allow no date range

Adds an All dates option and Skip date filter toggle.

No value applied yet.

Advanced examples

No presets

Calendar-only mode by hiding the preset sidebar.

No value applied yet.

Custom presets

Inject your own DateRangePreset array.

No value applied yet.

API reference

Props for SuperDateRangePicker.

PropTypeDefaultDescription
valueSuperDateRangeValue-Controlled value. Pass null for no date range.
defaultValueSuperDateRangeValue-Initial value for uncontrolled mode.
onApply(value) => void-Called when the user clicks Apply.
onChange(value) => void-Called for pending changes before Apply.
showPresetsbooleantrueShows preset sidebar.
presetsDateRangePreset[]DEFAULT_PRESETSCustom preset list.
defaultPresetstring-Preset key selected on first render.
showTimebooleanfalseAdds HH:mm:ss inputs.
showTimezonebooleanfalseShows searchable timezone selector.
timezonestring-Controlled timezone value.
defaultTimezonestringlocalInitial timezone for uncontrolled mode.
onTimezoneChange(tz) => void-Called when timezone changes.
dateFormatstringdd-MMM-yyyydate-fns format string for inputs and label.
minDateDate-Earliest selectable date.
maxDateDate-Latest selectable date.
disabledbooleanfalseDisables trigger button.
allowNoDateRangebooleanfalseEnables no-date-range mode.
noDateRangeLabelstringAll datesLabel for no-date-range option.
placeholderstringSelect date rangeTrigger placeholder text.
triggerClassNamestring-Extra trigger classes.
triggerVariantstringoutlineTrigger button variant.
alignstart | center | endstartPopover alignment.
openboolean-Controlled popover open state.
onOpenChange(open) => void-Called when open state changes.
aria-labelstringautoAccessible label for trigger button.
aria-describedbystring-ID describing the picker.
idstring-ID forwarded to trigger button.
classNamestring-Extra wrapper classes.