---
title: Date Picker
description: A date picker component with range and presets.
component: true
source:
shadcn: true
---
## Installation
The Date Picker is built using a composition of the ``, `` and `` components.
See installation instructions for the [Popover](/docs/components/popover#installation) and the [Calendar](/docs/components/calendar#installation) components.
## Usage
```tsx
'use client'
import { format } from 'date-fns'
import * as React from 'react'
import { Button, Calendar } from 'ui'
import {
DatePicker,
DatePickerButton,
DatePickerContent,
DatePickerTrigger,
} from 'ui-patterns/DatePicker'
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.
## API Reference
- `` accepts the same props as [the `` component](./popover).
- `` accepts the same props as [the `` component](./popover#api-reference).
- `` accepts the same props as [the `` component](./popover#api-reference).
- `` accepts the same props as [the `` component](./button) and an optional `isInvalid` prop to visually indicate an invalid date.
## Examples
### Date Picker
### Date Range Picker
### With Presets
### Form