---
title: Date Picker
description: A date picker component with range and presets.
base: base
component: true
---
## Installation
The Date Picker is built using a composition of the `` and the `` components.
See installation instructions for the [Popover](/docs/components/base/popover#installation) and the [Calendar](/docs/components/base/calendar#installation) components.
## Usage
```tsx showLineNumbers title="components/example-date-picker.tsx"
"use client"
import * as React from "react"
import { format } from "date-fns"
import { Calendar as CalendarIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
import { Calendar } from "@/components/ui/calendar"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover"
export function DatePickerDemo() {
const [date, setDate] = React.useState()
return (
}
>
{date ? format(date, "PPP") : Pick a date}
)
}
```
See the [React DayPicker](https://react-day-picker.js.org) documentation for more information.
## Examples
### Basic
A basic date picker component.
### Range Picker
A date picker component for selecting a range of dates.
### Date of Birth
A date picker component for selecting a date of birth. This component includes a dropdown caption layout for date and month selection.
### Input
A date picker component with an input field for selecting a date.
### Time Picker
A date picker component with a time input field for selecting a time.
### Natural Language Picker
This component uses the `chrono-node` library to parse natural language dates.
## RTL
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).