All components
Chewypixel component

Date Picker

A date field that opens a calendar. Months slide in the direction you page, and arrow keys move between days.

Installation

npx shadcn@latest add @chewypixel/date-picker

Usage

"use client";

import { useState } from "react";
import { DatePicker } from "@/components/ui/calendar";

export function DeliveryDate() {
  const [date, setDate] = useState<string>();

  return <DatePicker value={date} onChange={setDate} placeholder="Pick a delivery date" />;
}

Props

value

The selected date, as YYYY-MM-DD.

string

onChange

Called with the picked date, as YYYY-MM-DD.

(date: string) => void

min

The earliest date that can be picked, as YYYY-MM-DD.

string

max

The latest date that can be picked, as YYYY-MM-DD.

string

format

How the field shows the date, as a Day.js format.

string = "ddd, MMM D, YYYY"

placeholder

Shown while no date is picked. For an inline calendar, use Calendar instead of DatePicker.

string = "Pick a date"

Released under the MIT License.

More components

See them in a real app

These components come from Mochi, our admin dashboard template built with Next.js, shadcn/ui and Motion.