# @salmonui/calendars/date-range-picker API reference

> 31 exported symbols of @salmonui/calendars/date-range-picker: 1 component, 5 functions, 14 interfaces, 10 types and 1 constant.

Canonical: https://salmonui.dev/docs/reference/calendars/date-range-picker

```ts
import { … } from '@salmonui/calendars/date-range-picker';
```

## Components

### DateRangePicker

Kind: component

Page: https://salmonui.dev/docs/reference/calendars/date-range-picker/DateRangePicker

```ts
function DateRangePicker(props: DateRangePickerProps): import("react").JSX.Element;
```

Props: [`DateRangePickerProps`](https://salmonui.dev/docs/reference/calendars/date-range-picker/DateRangePickerProps) (its members are the props)

## Interfaces

### DateRangePickerLocaleText

Kind: interface

Page: https://salmonui.dev/docs/reference/calendars/date-range-picker/DateRangePickerLocaleText

```ts
interface DateRangePickerLocaleText {
    readonly chooseRange: PickerMessage;
    readonly startDate: PickerMessage;
    readonly endDate: PickerMessage;
    readonly presets: PickerMessage;
    readonly apply: PickerMessage;
    readonly cancel: PickerMessage;
    readonly clear: PickerMessage;
    readonly selectedDays: PickerMessage;
    readonly noRange: PickerMessage;
    readonly rangeUnderflow: PickerMessage;
    readonly rangeOverflow: PickerMessage;
    readonly tooShort: PickerMessage;
    readonly tooLong: PickerMessage;
    readonly reversed: PickerMessage;
    readonly unavailable: PickerMessage;
}
```

UI strings of `DateRangePicker` (`localeText`).

Members (15):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `chooseRange` | `readonly chooseRange: PickerMessage;` |  |  |
| `startDate` | `readonly startDate: PickerMessage;` |  |  |
| `endDate` | `readonly endDate: PickerMessage;` |  |  |
| `presets` | `readonly presets: PickerMessage;` |  |  |
| `apply` | `readonly apply: PickerMessage;` |  |  |
| `cancel` | `readonly cancel: PickerMessage;` |  |  |
| `clear` | `readonly clear: PickerMessage;` |  |  |
| `selectedDays` | `readonly selectedDays: PickerMessage;` |  | Range summary: `{count}` days (plural forms). |
| `noRange` | `readonly noRange: PickerMessage;` |  |  |
| `rangeUnderflow` | `readonly rangeUnderflow: PickerMessage;` |  |  |
| `rangeOverflow` | `readonly rangeOverflow: PickerMessage;` |  |  |
| `tooShort` | `readonly tooShort: PickerMessage;` |  | `{min}` days. |
| `tooLong` | `readonly tooLong: PickerMessage;` |  | `{max}` days. |
| `reversed` | `readonly reversed: PickerMessage;` |  |  |
| `unavailable` | `readonly unavailable: PickerMessage;` |  |  |

### DateRangePickerProps

Kind: interface

Page: https://salmonui.dev/docs/reference/calendars/date-range-picker/DateRangePickerProps

```ts
interface DateRangePickerProps extends PickerFieldProps, Omit<PickerCalendarProps, 'focusedValue' | 'defaultFocusedValue'> {
    readonly value?: DateRange<DateInput> | null | undefined;
    readonly defaultValue?: DateRange<DateInput> | null | undefined;
    readonly onValueChange?: ((value: DateRange | null, details: DateRangePickerValueChangeDetails) => void) | undefined;
    readonly onRangeSelect?: ((range: DateRange) => void) | undefined;
    readonly granularity?: 'day' | 'month' | 'year' | undefined;
    readonly min?: DateInput | null | undefined;
    readonly max?: DateInput | null | undefined;
    readonly minDays?: number | undefined;
    readonly maxDays?: number | undefined;
    readonly rangeOverDisabled?: 'block' | 'allow' | undefined;
    readonly presets?: readonly DateRangePreset[] | undefined;
    readonly separator?: ReactNode | undefined;
    readonly confirm?: boolean | undefined;
    readonly visibleMonths?: number | undefined;
    readonly startName?: string | undefined;
    readonly endName?: string | undefined;
    readonly format?: Intl.DateTimeFormatOptions | string | undefined;
    readonly localeText?: Partial<DateRangePickerLocaleText> | undefined;
    readonly ref?: Ref<PickerHandle> | undefined;
}
```

Members (66):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `disabled` | `disabled?: boolean;` | optional, inherited |  |
| `readOnly` | `readOnly?: boolean;` | optional, inherited |  |
| `value` | `readonly value?: DateRange<DateInput> \| null \| undefined;` | optional |  |
| `defaultValue` | `readonly defaultValue?: DateRange<DateInput> \| null \| undefined;` | optional |  |
| `onValueChange` | `readonly onValueChange?: ((value: DateRange \| null, details: DateRangePickerValueChangeDetails) => void) \| undefined;` | optional |  |
| `onRangeSelect` | `readonly onRangeSelect?: ((range: DateRange) => void) \| undefined;` | optional | Both ends chosen in the popup, before Apply. |
| `granularity` | `readonly granularity?: 'day' \| 'month' \| 'year' \| undefined;` | optional |  |
| `min` | `readonly min?: DateInput \| null \| undefined;` | optional |  |
| `max` | `readonly max?: DateInput \| null \| undefined;` | optional |  |
| `minDays` | `readonly minDays?: number \| undefined;` | optional | Shortest and longest allowed span in days, inclusive. |
| `maxDays` | `readonly maxDays?: number \| undefined;` | optional |  |
| `rangeOverDisabled` | `readonly rangeOverDisabled?: 'block' \| 'allow' \| undefined;` | optional | Whether a range may span `isDateDisabled` days. Default `'block'`. |
| `presets` | `readonly presets?: readonly DateRangePreset[] \| undefined;` | optional |  |
| `separator` | `readonly separator?: ReactNode \| undefined;` | optional | Between the two fields; also splits pasted text. Default an en dash. |
| `confirm` | `readonly confirm?: boolean \| undefined;` | optional | Apply / Cancel in the popup (default `true`); `false` commits on the second selection. |
| `visibleMonths` | `readonly visibleMonths?: number \| undefined;` | optional | Months shown side by side (default 2; one under a narrow container). |
| `startName` | `readonly startName?: string \| undefined;` | optional | Form names of the two ends; `name` posts one ISO interval instead. |
| `endName` | `readonly endName?: string \| undefined;` | optional |  |
| `format` | `readonly format?: Intl.DateTimeFormatOptions \| string \| undefined;` | optional |  |
| `localeText` | `readonly localeText?: Partial<DateRangePickerLocaleText> \| undefined;` | optional |  |
| `ref` | `readonly ref?: Ref<PickerHandle> \| undefined;` | optional |  |
| `firstDayOfWeek` | `firstDayOfWeek?: number;` | optional, inherited |  |
| `showWeekNumbers` | `showWeekNumbers?: boolean;` | optional, inherited |  |
| `weekRule` | `weekRule?: WeekRule;` | optional, inherited |  |
| `weekdayFormat` | `weekdayFormat?: WeekdayFormat;` | optional, inherited |  |
| `calendar` | `calendar?: string;` | optional, inherited | `Intl` calendar id (`'gregory'`, `'islamic-umalqura'`, `'japanese'`, ...). |
| `showTodayButton` | `showTodayButton?: boolean;` | optional, inherited |  |
| `showOutsideDays` | `showOutsideDays?: boolean;` | optional, inherited |  |
| `isDateDisabled` | `isDateDisabled?: ((date: PlainDate) => boolean);` | optional, inherited |  |
| `renderDay` | `renderDay?: ((ctx: CalendarDayContext) => ReactNode);` | optional, inherited |  |
| `getDayProps` | `getDayProps?: ((ctx: CalendarDayContext) => CalendarDayProps \| undefined);` | optional, inherited |  |
| `view` | `view?: CalendarView;` | optional, inherited |  |
| `defaultView` | `defaultView?: CalendarView;` | optional, inherited |  |
| `onViewChange` | `onViewChange?: ((view: CalendarView) => void);` | optional, inherited |  |
| `onFocusedValueChange` | `onFocusedValueChange?: ((date: PlainDate) => void);` | optional, inherited |  |
| `open` | `open?: boolean;` | optional, inherited |  |
| `defaultOpen` | `defaultOpen?: boolean;` | optional, inherited |  |
| `onOpenChange` | `onOpenChange?: ((open: boolean, details: PickerOpenChangeDetails) => void);` | optional, inherited |  |
| `popupMode` | `popupMode?: PopupMode;` | optional, inherited |  |
| `openOnFocus` | `openOnFocus?: boolean;` | optional, inherited | Opens the popup when focus enters the field. |
| `editable` | `editable?: boolean;` | optional, inherited | `false` makes the segments read-only; a click on the field opens the popup. |
| `clearable` | `clearable?: boolean;` | optional, inherited | Renders a clear button. |
| `onClear` | `onClear?: (() => void);` | optional, inherited |  |
| `strict` | `strict?: boolean;` | optional, inherited | Out-of-range values move to the nearest bound and disabled or unparsable input reverts on blur. |
| `required` | `required?: boolean;` | optional, inherited |  |
| `invalid` | `invalid?: boolean;` | optional, inherited |  |
| `label` | `label?: ReactNode;` | optional, inherited |  |
| `description` | `description?: ReactNode;` | optional, inherited |  |
| `errorMessage` | `errorMessage?: ReactNode;` | optional, inherited |  |
| `placeholder` | `placeholder?: string;` | optional, inherited | Watermark shown while empty and not focused. |
| `name` | `name?: string;` | optional, inherited |  |
| `form` | `form?: string;` | optional, inherited |  |
| `autoFocus` | `autoFocus?: boolean;` | optional, inherited |  |
| `onFocus` | `onFocus?: ((event: FocusEvent<Element, Element>) => void);` | optional, inherited | Focus entered the field group (once). |
| `onBlur` | `onBlur?: ((event: FocusEvent<Element, Element>) => void);` | optional, inherited | Focus left the field group and its popup (once). |
| `onInvalid` | `onInvalid?: (() => void);` | optional, inherited | The form value input failed constraint validation. |
| `locale` | `locale?: string;` | optional, inherited | BCP 47 locale; default `'en-US'`. |
| `timeZone` | `timeZone?: string;` | optional, inherited | IANA time zone for instant values (`Date`, ISO with an offset). |
| `hourCycle` | `hourCycle?: "h12" \| "h23";` | optional, inherited |  |
| `size` | `size?: "lg" \| "md" \| "sm";` | optional, inherited | Control size: `'sm'` 24px, `'md'` 32px (default), `'lg'` 40px tall. |
| `id` | `id?: string;` | optional, inherited |  |
| `className` | `className?: string;` | optional, inherited |  |
| `style` | `style?: CSSProperties;` | optional, inherited |  |
| `aria-label` | `aria-label?: string;` | optional, inherited |  |
| `aria-labelledby` | `aria-labelledby?: string;` | optional, inherited |  |
| `aria-describedby` | `aria-describedby?: string;` | optional, inherited |  |

### DateRangePickerValueChangeDetails

Kind: interface

Page: https://salmonui.dev/docs/reference/calendars/date-range-picker/DateRangePickerValueChangeDetails

```ts
interface DateRangePickerValueChangeDetails {
    readonly source: ChangeSource;
    readonly reason: 'input' | 'calendar' | 'preset' | 'apply' | 'clear' | 'reset' | 'strict';
    readonly iso: string;
}
```

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `source` | `readonly source: ChangeSource;` |  |  |
| `reason` | `readonly reason: 'input' \| 'calendar' \| 'preset' \| 'apply' \| 'clear' \| 'reset' \| 'strict';` |  |  |
| `iso` | `readonly iso: string;` |  | The ISO 8601 interval `start/end` (`''` when empty). |

### DateRangePreset

Kind: interface

Page: https://salmonui.dev/docs/reference/calendars/date-range-picker/DateRangePreset

```ts
interface DateRangePreset {
    readonly label: ReactNode;
    readonly value: DateRange<DateInput> | (() => DateRange<DateInput>);
}
```

A preset range. Function values are evaluated when the popup opens.

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `label` | `readonly label: ReactNode;` |  |  |
| `value` | `readonly value: DateRange<DateInput> \| (() => DateRange<DateInput>);` |  |  |

## Constants

### DATE_RANGE_PICKER_DEFAULT_LOCALE_TEXT

Kind: const

Page: https://salmonui.dev/docs/reference/calendars/date-range-picker/DATE_RANGE_PICKER_DEFAULT_LOCALE_TEXT

```ts
const DATE_RANGE_PICKER_DEFAULT_LOCALE_TEXT: DateRangePickerLocaleText;
```

## Re-exported entry points

- [@salmonui/calendars/calendar](https://salmonui.dev/docs/reference/calendars/calendar.md): 20 symbols: 5 functions, 8 interfaces and 7 types
  `CalendarDayContext`, `CalendarDayProps`, `CalendarView`, `DateInput`, `DateRange`, `DateTimeInput`, `PlainDate`, `PlainDateLike`, `PlainDateTime`, `PlainDateTimeLike`, `PlainTime`, `PlainTimeLike`, `TimeInput`, `WeekRule`, `WeekdayFormat`, `getRangeDays`, `toDate`, `toPlainDate`, `toPlainDateTime`, `toPlainTime`
- [@salmonui/calendars/date-picker](https://salmonui.dev/docs/reference/calendars/date-picker.md): 5 symbols: 2 interfaces and 3 types
  `ChangeSource`, `PickerHandle`, `PickerMessage`, `PickerOpenChangeDetails`, `PopupMode`
