• Stars
    star
    6,039
  • Rank 6,661 (Top 0.2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 10 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DayPicker is a customizable date picker component for React. Add date pickers, calendars, and date inputs to your web applications.

React DayPicker

DayPicker is a date picker component for React. Renders a monthly calendar to select days. DayPicker is customizable, works great with input fields and can be styled to match any design.

➑️ react-day-picker.js.org for guides, examples and API reference.

Shows a screenshot of the React DayPicker component in a browser’s window.

Main features

  • β˜€οΈ Select days, ranges or whatever
  • πŸ§˜β€β™€οΈ using date-fns as date library
  • 🌎 Localizable into any language
  • ➑️ Keyboard navigation
  • ♿️ WAI-ARIA support
  • πŸ€– Written in TypeScript
  • 🎨 Easy to style and customize
  • πŸ—“ Support multiple calendars
  • πŸ“„ Easy to integrate input fields

Installation

npm install react-day-picker date-fns  # using npm
pnpm install react-day-picker date-fns # using pnpm
yarn add react-day-picker date-fns     # using yarn
npm version npm downloads stars sponsors

Example

import React from 'react';

import { format } from 'date-fns';
import { DayPicker } from 'react-day-picker';
import 'react-day-picker/dist/style.css';

export default function Example() {
  const [selected, setSelected] = React.useState<Date>();

  let footer = <p>Please pick a day.</p>;
  if (selected) {
    footer = <p>You picked {format(selected, 'PP')}.</p>;
  }
  return (
    <DayPicker
      mode="single"
      selected={selected}
      onSelect={setSelected}
      footer={footer}
    />
  );
}

Documentation

See react-day-picker.js.org for guides, examples and API reference of the latest version. Docs for version 7 are at react-day-picker-v7.netlify.app.