# DateRangeField

Two segmented date fields with one ordered range and atomic form values.

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, DateRangeField } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <DateRangeField label="Travel dates" startName="start" endName="end" defaultValue={{start:"2026-10-12",end:"2026-10-18"}} />
    </FloodRoot>
  );
}
```

## Design notes

- The value is {start,end}, with canonical YYYY-MM-DD dates or empty endpoints. Editable partial, reversed, unavailable and refused ranges block native submission. Readonly submits a complete ordered accepted pair despite current bounds/availability; partial, reversed and refused pairs stay atomic empty values.
- Both named bridges represent one range contract. The group owns relationship validation while each DateField preserves its calendar validity and keyboard behavior.
- Start/end names and labels are explicit; min/max, readonly/disabled, status and form reset follow the field contracts.
- Use DateRangePicker for visual interval selection. Introduced in 0.2.7.

## API reference

| Prop | Values | Default |
| --- | --- | --- |
| `hideLabel` | `boolean` | `—` |
| `min` | `string` | `—` |
| `max` | `string` | `—` |
| `required` | `boolean` | `—` |
| `readOnly` | `boolean` | `—` |
| `disabled` | `boolean` | `—` |
| `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"` | `"month-day-year"` |
| `segmentLabels` | `Partial<Record<"day" \| "month" \| "year", string>>` | `—` |
| `messages` | `{ required?: string; invalid?: string; outOfRange?: string }` | `—` |
| `validationMessage` | `string` | `—` |
| `label` | `string` | `Required` |
| `value` | `DateRangeValue` | `—` |
| `defaultValue` | `DateRangeValue` | `—` |
| `onValueChange` | `(range: DateRangeValue) => void` | `—` |
| `startName` | `string` | `—` |
| `endName` | `string` | `—` |
| `startLabel` | `string` | `"Start date"` |
| `endLabel` | `string` | `"End date"` |
| `end` | `ReactNode` | `—` |
| `isDateDisabled` | `(date: string) => boolean` | `—` |
| `isRangeDisabled` | `(range: DateRangeValue) => boolean` | `—` |
| `rangeMessages` | `{ incomplete?: string; reversed?: string; unavailable?: string }` | `—` |
| `Native HTML props` | `Omit<Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" \| "onChange" \| "children">, "value" \| "defaultValue" \| "onValueChange" \| "name" \| "label" \| "end">` | `Forwarded` |
