# DatePicker

A segmented date field with an integrated calendar picker and shared form value.

Connect Flood once using [the installation guide](https://flood.md/docs/installation). Then import the components you use; no per-component add command is needed.

## Example

```tsx
"use client";

import { FloodRoot, DatePicker } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <DatePicker label="Start date" name="start" defaultValue="2026-10-26" today="2026-10-26" />
    </FloodRoot>
  );
}
```

## Design notes

- Composes Flood DateField, Calendar and Popover; text input and visual selection share one canonical value and form bridge.
- Activate the calendar icon or Alt+ArrowDown in a segment. Escape/outside dismissal returns or preserves intended focus through the existing overlay engine. Selecting a day closes the calendar.
- Read only and disabled prevent opening or date changes; native disabled fieldsets remain inert. Invalid/incomplete drafts retain native DateField validation.
- Controlled value and open state are independently host-owned. Native form reset restores the initial uncontrolled date and preserves cancelled resets. Translate calendarLabel/openCalendarLabel, month navigation, segment labels and messages.
- DateField remains the keyboard-entry primitive; Calendar remains independently usable. Introduced in the unpublished 0.2.7 source candidate.

## API reference

| Prop | Values | Default |
| --- | --- | --- |
| `label` | `string` | `Required` |
| `hideLabel` | `boolean` | `—` |
| `value` | `string` | `—` |
| `defaultValue` | `string` | `—` |
| `onValueChange` | `(value: string) => void` | `—` |
| `min` | `string` | `—` |
| `max` | `string` | `—` |
| `required` | `boolean` | `—` |
| `readOnly` | `boolean` | `—` |
| `disabled` | `boolean` | `—` |
| `name` | `string` | `—` |
| `form` | `string` | `—` |
| `controlSize` | `"sm" \| "md" \| "lg" \| "xl"` | `"md"` |
| `invalid` | `boolean` | `—` |
| `status` | `"error" \| "warning" \| "success" \| "info"` | `—` |
| `description` | `string` | `—` |
| `order` | `"month-day-year" \| "day-month-year" \| "year-month-day"` | `—` |
| `segmentLabels` | `Partial<Record<"day" \| "month" \| "year", string>>` | `—` |
| `messages` | `{ required?: string; invalid?: string; outOfRange?: string }` | `—` |
| `validationMessage` | `string` | `—` |
| `open` | `boolean` | `—` |
| `defaultOpen` | `boolean` | `false` |
| `onOpenChange` | `(open: boolean) => void` | `—` |
| `calendarLabel` | `string` | `—` |
| `openCalendarLabel` | `string` | `—` |
| `locale` | `string` | `—` |
| `weekStartsOn` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6` | `—` |
| `today` | `string` | `—` |
| `previousMonthLabel` | `string` | `—` |
| `nextMonthLabel` | `string` | `—` |
| `Native HTML props` | `Omit<Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" \| "onChange" \| "children">, "end">` | `Forwarded` |
