apps/design-system/content/docs/components/calendar.mdx
The Calendar component is built on top of React DayPicker.
npx shadcn-ui@latest add calendar
<Step>Install the following dependencies:</Step>
npm install react-day-picker date-fns
<Step>Add the Button component to your project.</Step>
The Calendar component uses the Button component. Make sure you have it installed in your project.
<Step>Copy and paste the following code into your project.</Step>
<ComponentSource name="calendar" /><Step>Update the import paths to match your project setup.</Step>
</Steps> </TabsContent> </Tabs>import { Calendar } from '@/components/ui/calendar'
const [date, setDate] = React.useState<Date | undefined>(new Date())
return <Calendar mode="single" selected={date} onSelect={setDate} className="rounded-md border" />
See the React DayPicker documentation for more information.
You can use the <Calendar> component to build a date picker. See the Date Picker page for more information.