Introduction

Installation

DayPicker is available as react-day-picker npm package. It requires date-fns as a peer dependency.

There's an ongoing discussion to support other date libraries.

Install from npm

$ npm install react-day-picker date-fns

Basic Usage

To start using DayPicker, import the <DayPicker /> component and its default style. Assign the selected and onSelect props to manage the selected date.

./App.jsx
import "react-day-picker/style.css"; // Import the default style
import { DayPicker } from "react-day-picker";
 
import { useState } from "react";
 
export function App() {
  const [selected, setSelected] = useState();
 
  return (
    <div role="application" aria-label="Date Picker">
      <DayPicker mode="single" selected={selected} onSelect={setSelected} />
    </div>
  );
}
March 2024
SuMoTuWeThFrSa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

Getting Started

Get started with DayPicker by reading the following guides.

Using DayPicker

  • Customization Props - Read about the options available to customize the calendar and the months navigation.
  • Selection Modes - Allow users to select days by enabling single, multiple or range selections.
  • Styling - Change the style to make DayPicker match your app's look and feel.
  • Localization - Configure DayPicker to display the calendar in different languages and date formats.
  • Accessible Date Pickers - Make your date picker accessible to all users, including those using screen readers.
  • DayPicker Playground - Play with the props to try the different customization options.

Advanced Guides