--- title: Calendar description: A date field component that allows users to enter and edit date. component: true links: doc: https://react-day-picker.js.org --- ## About The `Calendar` component is built on top of [React DayPicker](https://react-day-picker.js.org). ## Installation CLI Manual ```bash npx shadcn@latest add calendar ``` Install the following dependencies: ```bash npm install react-day-picker date-fns ``` Add the `Button` component to your project. The `Calendar` component uses the `Button` component. Make sure you have it installed in your project. Copy and paste the following code into your project. Update the import paths to match your project setup. ## Usage ```tsx import { Calendar } from "@/components/ui/calendar" ``` ```tsx const [date, setDate] = React.useState(new Date()) return ( ) ``` See the [React DayPicker](https://react-day-picker.js.org) documentation for more information. ## Date Picker You can use the `` component to build a date picker. See the [Date Picker](/docs/components/date-picker) page for more information. ## Examples ### Form ## Changelog ### 11-03-2024 day_outside color - Changed the color of the `day_outside` class to the following to improve contrast: ```tsx showLineNumbers title="calendar.tsx" "day_outside: "day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground", ```