# Date Picker

- **Section:** Components
- **URL:** https://refast.fastapicloud.dev/docs/components/date-picker
- **Markdown:** https://refast.fastapicloud.dev/docs/components/date-picker.md
- **Source:** https://github.com/idling-mind/refast-docs/blob/main/docs/pages/components/form_inputs/date_picker.py
- **Live examples:** the widgets on this page need a browser; open the URL above to try them.
- **Applies to:** refast 0.12.2

A button trigger that opens a calendar popover for date selection.
Supports single, multiple, and range date selection.

```python
from refast.components.shadcn.controls import DatePicker

DatePicker(
    label="Appointment date",
    placeholder="Pick a date",
    on_change=ctx.callback(handle_date_change),
)
```

```python
DatePicker(
    label="Date",
    mode="single",
    disabled=False,
    required=False,
    caption_layout='dropdown',
    required=False,
    on_change=ctx.callback(handle_change),
)
```

## Props

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `value` | `date \| list[date] \| dict \| None` | `None` | Controlled selected value |
| `mode` | `"single" \| "multiple" \| "range"` | `"single"` | Selection mode |
| `placeholder` | `str` | `"Pick a date"` | Button text when no date selected |
| `disabled` | `bool` | `False` | Disables interaction |
| `format` | `str` | `"PPP"` | date-fns format string |
| `caption_layout` | `"label" \| "dropdown" \| ...` | `"label"` | Calendar header style |
| `min_date` | `date \| str \| None` | `None` | Earliest selectable date |
| `max_date` | `date \| str \| None` | `None` | Latest selectable date |
| `label` | `str \| None` | `None` | Label text |
| `description` | `str \| None` | `None` | Help text |
| `required` | `bool` | `False` | Shows required asterisk |
| `error` | `str \| None` | `None` | Error message |
| `on_change` | `Callback \| None` | `None` | Fired when selection changes |

## Range Mode

```python
DatePicker(
    mode="range",
    placeholder="Select date range",
    on_change=ctx.callback(handle_range),
)
```

---

Part of the Refast documentation: [all pages](https://refast.fastapicloud.dev/llms.txt), [everything on one page](https://refast.fastapicloud.dev/llms-full.txt), [search](https://refast.fastapicloud.dev/api/search?q=save_prop).
