Componentpickers1.79 KB gzipZero dependencies

DateRangePicker

Two-month mini calendar grid for selecting start and end dates with nights count

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add date-range-picker

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { DateRangePicker } from "@/components/ui/date-range-picker"; <DateRangePicker defaultValue={[{ start: new Date(2024, 0, 1), end: new Date(2024, 0, 7)}]} onValueChange={(v) => {}} />

Source code

date-range-picker.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxdate-range-picker.tsx234 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface DateRangePickerProps extends Omit<React.HTMLAttributes<HTMLElement>, "value" | "defaultValue"> {  value?: [Date, Date];  defaultValue?: [Date, Date];  onValueChange?: (value: [Date, Date] | undefined) => void;  min?: Date;  max?: Date;  className?: string;} const MONTHS = [  "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE",  "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER",];

Props

PropTypeDescription
value[Date, Date]Controlled value.
defaultValue[Date, Date]Initial value when uncontrolled.
onValueChange(value: [Date, Date] | undefined) => voidCallback invoked on value change.
minDateMinimum allowed numeric or date bound.
maxDateMaximum allowed numeric or date bound.
classNamestringOptional Tailwind or custom CSS classes merged with component styles.