包详细信息

react-day-picker

gpbl33mMIT9.7.0

Customizable Date Picker for React

自述文件

React DayPicker

DayPicker is a React component for creating date pickers, calendars, and date inputs for web applications.

Documentation

See daypicker.dev for guides, examples and API reference, or read the docs in the repository.

<picture> <source media="(prefers-color-scheme: dark)" srcset="./website/static/img/screenshot-dark.png" /> <source media="(prefers-color-scheme: light)" srcset="./website/static/img/screenshot-light.png" /> Screenshot of DayPicker displaying the September 2025 calendar, with the date range from the 17th to the 20th selected. </picture>

Features

DayPicker is written in TypeScript and compiled to CommonJS and ESM. It relies on date-fns for date manipulation and formatting.

Installation

npm install react-day-picker

npm version npm downloads Min gzipped size

Example

import { DayPicker } from "react-day-picker";
import "react-day-picker/style.css";

function MyDatePicker() {
  const [selected, setSelected] = useState<Date>();

  return (
    <DayPicker
      mode="single"
      selected={selected}
      onSelect={setSelected}
      footer={
        selected ? `Selected: ${selected.toLocaleDateString()}` : "Pick a day."
      }
    />
  );
}

Compatibility

DayPicker is compatible with React 16.8 and later.

License

DayPicker is released under the MIT License.

Community

Ask for help and share your experience with DayPicker:

Funding

Consider supporting DayPicker's maintainer with a donation. Your support helps keep the project alive and up-to-date.