Skip to content
v0.2.10

DateRangeField

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

Preview

Use DateRangeField

DateRangeField is a named export of @flood-md/react. Connect the package once, then import what you use.

First time here? Connect Flood
Example import style
date-range-field.tsxTSX
"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

PropValuesDefault
hideLabelboolean—
minstring—
maxstring—
requiredboolean—
readOnlyboolean—
disabledboolean—
formstring—
controlSize"sm" | "md" | "lg" | "xl""md"
invalidboolean—
status"error" | "warning" | "success" | "info"—
descriptionstring—
order"month-day-year" | "day-month-year" | "year-month-day""month-day-year"
segmentLabelsPartial<Record<"day" | "month" | "year", string>>—
messages{ required?: string; invalid?: string; outOfRange?: string }—
validationMessagestring—
labelstringRequired
valueDateRangeValue—
defaultValueDateRangeValue—
onValueChange(range: DateRangeValue) => void—
startNamestring—
endNamestring—
startLabelstring"Start date"
endLabelstring"End date"
endReactNode—
isDateDisabled(date: string) => boolean—
isRangeDisabled(range: DateRangeValue) => boolean—
rangeMessages{ incomplete?: string; reversed?: string; unavailable?: string }—
Native HTML propsOmit<Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange" | "children">, "value" | "defaultValue" | "onValueChange" | "name" | "label" | "end">Forwarded
View TypeScript source