Componentpickers2.92 KB gzipZero dependencies

Date Picker

Date picker input with popover calendar and quick date selection.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

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

npx bigbullui add date-picker

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { DatePicker } from "@/components/ui/date-picker"; <DatePicker defaultValue={new Date()} onValueChange={(d) => console.log(d)} />

Source code

date-picker.tsx + 4 helpers

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

tsxdate-picker.tsx411 lines
"use client"; import * as React from "react";import { createPortal } from "react-dom";import { cn } from "./lib/utils";import { mergeRefs, useIsMounted } from "./lib/react-compat";import { useFloating } from "./lib/floating";import { registerEscapeLayer } from "./lib/focus-trap"; export interface DatePickerProps {  value?: Date;  defaultValue?: Date;  onValueChange?: (date: Date) => void;  placeholder?: string;  disabled?: boolean;  required?: boolean;  name?: string;  id?: string;

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { DatePicker } from "@/components/ui/date-picker"; <DatePicker />
PropTypeDescription
valueDateControlled value.
defaultValueDateInitial value when uncontrolled.
onValueChange(date: Date) => voidCallback invoked on value change.
placeholderstringPlaceholder text shown when empty. (Default: "SELECT ADMISSION DATE")
disabledbooleanDisables interaction and applies disabled styling. (Default: false)
requiredbooleanMarks the input as required for native form validation. (Default: false)
namestringForm field name submitted during form serialization.
idstringDOM element identifier for label association and testing.
minDateDateConfigures min date.
maxDateDateConfigures max date.
localestringConfigures locale. (Default: "en-US")
weekStartsOn0 | 1Configures week starts on. (Default: 0)
aria-labelstringConfigures aria label.
classNamestringOptional Tailwind or custom CSS classes merged with component styles.