label | string · requiredLabel text. |
|---|
isLabelHidden | boolean · default falseVisually hide the label. |
|---|
description | stringHelper text displayed below the label. |
|---|
isOptional | boolean · default falseShow an "(optional)" indicator. |
|---|
isRequired | boolean · default falseMark the field as required. |
|---|
isDisabled | boolean · default falseDisable the trigger and picker. |
|---|
disabledMessage | stringExplains why the input is disabled. With isDisabled, shows a tooltip on hover/keyboard focus and keeps the field focusable via aria-disabled (activation stays blocked). Use this instead of wrapping a disabled DateRangeInput in Tooltip. Disabled controls swallow the hover events an external Tooltip needs. |
|---|
value | DateRange | null · requiredSelected date range or null. Import the DateRange type from @astryxdesign/core/DateRangeInput; it is {start: ISODateString, end: ISODateString}. Do NOT redeclare your own DateRange type; use the exported one so TypeScript structurally matches. |
|---|
onChange | (value: DateRange | null) => void · requiredCallback when the range changes. Called with null on clear. |
|---|
changeAction | (value: DateRange | null) => void | Promise<void>Async action fired after onChange. Drives optimistic UI updates via useTransition. |
|---|
isLoading | boolean · default falseWhether the input is in a loading state. Disables interaction and shows a spinner. |
|---|
min | ISODateStringMinimum selectable date. ISODateString is a template literal type (\${number}${number}${number}${number}-${number}${number}-${number}${number}\`). Pass a string literal like "2026-01-28", not a runtime string variable. Import it from @astryxdesign/core/Calendar or use as ISODateString` if computing the value dynamically. |
|---|
max | ISODateStringMaximum selectable date. Same template literal type as min: use a YYYY-MM-DD string literal or cast with as ISODateString. |
|---|
dateConstraints | Array<(date: Date) => boolean>Custom constraint functions to disable specific dates. |
|---|
maxRangeSpan | numberMaximum days a selected range may span, counting both endpoints (7 = a 7-day window, start + 6). Once a start is picked, days beyond this distance are disabled so the range cannot stretch past the cap. Rolling window relative to the start; for fixed calendar bounds use min/max. Constrains selection only; it never rewrites a value already wider than the cap (flag that with status). |
|---|
minRangeSpan | numberMinimum days a selected range must span, counting both endpoints (2 forbids a single-day range). Once a start is picked, days closer than this are disabled. Clicking the start again commits a one-day range when allowed, or cancels the in-progress selection when the minimum is longer. Defaults to 1 (same-day start and end allowed). |
|---|
presets | Array<DateRangePreset>Preset ranges shown as quick-select options beside the calendar. A preset is disabled when either endpoint violates min, max, or dateConstraints, or when its span violates minRangeSpan or maxRangeSpan. |
|---|
hasClear | boolean · default trueShows a clear button when a range is selected. |
|---|
placeholder | string · default 'Select date range'Placeholder text when no range is selected. |
|---|
size | 'sm' | 'md' | 'lg' · default 'md'Size of the trigger. |
|---|
status | {type: 'warning' | 'error' | 'success', message?: string}Status indicator for error, warning, or success states. |
|---|
statusVariant | 'attached' | 'detached' | 'tooltip' · default 'attached'How the status message is placed relative to the input. attached overlaps directly below the input (bordered treatment); detached floats below as a separate element with spacing; tooltip hides the message box and surfaces it in a tooltip on the status icon. |
|---|
labelTooltip | stringTooltip text via info icon at label end. |
|---|
numberOfMonths | 1 | 2 · default 2Number of months in the calendar. |
|---|
weekStartsOn | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' · default 0First day of week in the calendar. A number (0 = Sunday to 6 = Saturday) or a three-letter day name. |
|---|
width | SizeValueWidth of the field (number = pixels, string used as-is, e.g. "100%"). Sizes the whole field (label, control, and status) so they stay aligned. |
|---|
xstyle | StyleXStylesStyleX styles for layout customization. |
|---|