# DatePicker

> A button that opens a Calendar popup.

- Category: [Inputs & forms](https://tarve.dev/docs.md#inputs)
- Import: `import { DatePicker } from "@tarve/core";`
- Props type: `DatePickerProps`
- Source: [packages/core/src/extra-controls.ts:491](https://github.com/omarcosr/tarve/blob/main/packages/core/src/extra-controls.ts#L491)

## Usage

```tsx title="DatePicker.tsx"
import { DatePicker } from "@tarve/core";

let open = true;
let month = "2026-09";
let date: string | undefined;

<DatePicker
  open={open}
  month={month}
  value={date}
  placeholder="Pick a date"
  onOpenChange={(next) => {
    open = next;
  }}
  onMonthChange={(next) => {
    month = next;
  }}
  onValueChange={(next) => {
    date = next;
    open = false;
  }}
/>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `month` (required) | `string` | — |  |
| `open` (required) | `boolean` | — |  |
| `disabled` | `boolean` | — |  |
| `formatValue` | `(date: string) => string` | `defaultDatePickerLabel` |  |
| `isDateDisabled` | `(date: string) => boolean` | — |  |
| `max` | `string` | — |  |
| `min` | `string` | — |  |
| `onMonthChange` | `(month: string) => void` | — |  |
| `onOpenChange` | `(open: boolean) => void` | — |  |
| `onValueChange` | `(date: string) => void` | — |  |
| `placeholder` | `string` | `"Pick a date"` |  |
| `value` | `string` | — |  |
| `weekStartsOn` | `CalendarWeekStartsOn` | `0` |  |

## Common props

Shared by every component (descriptions: https://tarve.dev/docs.md#common-props): `children`, `class`, `className`, `highlight`, `id`, `key`, `motionFrom`, `onHighlight`, `onPaste`, `onPointerLeave`, `onPointerMove`, `onSize`, `onTransitionEnd`, `rovingGroup`, `style`.

## Types

```ts title="CalendarWeekStartsOn"
type CalendarWeekStartsOn = 0 | 1 | 2 | 3 | 4 | 5 | 6;
```

Previous: [Calendar](https://tarve.dev/docs/components/Calendar.md) · Next: [Button](https://tarve.dev/docs/components/Button.md)

---

Tarve v0.13.8 · HTML version: https://tarve.dev/docs/components/DatePicker · Index for agents: https://tarve.dev/llms.txt
