Componentpickers2.92 KB gzipZero dependencies
Date Picker
Date picker input with popover calendar and quick date selection.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add date-pickerOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { DatePicker } from "@/components/ui/date-picker"; <DatePicker defaultValue={new Date()} onValueChange={(d) => console.log(d)} />Source code
date-picker.tsx + 4 helpersZero 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 />| Prop | Type | Description |
|---|---|---|
| value | Date | Controlled value. |
| defaultValue | Date | Initial value when uncontrolled. |
| onValueChange | (date: Date) => void | Callback invoked on value change. |
| placeholder | string | Placeholder text shown when empty. (Default: "SELECT ADMISSION DATE") |
| disabled | boolean | Disables interaction and applies disabled styling. (Default: false) |
| required | boolean | Marks the input as required for native form validation. (Default: false) |
| name | string | Form field name submitted during form serialization. |
| id | string | DOM element identifier for label association and testing. |
| minDate | Date | Configures min date. |
| maxDate | Date | Configures max date. |
| locale | string | Configures locale. (Default: "en-US") |
| weekStartsOn | 0 | 1 | Configures week starts on. (Default: 0) |
| aria-label | string | Configures aria label. |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |