Skip to Content
Urban Cowboy
Components

Date Search Dropdown

Date picker dropdown with calendar, quick-select ranges and confirm actions.

DateSearchDropdown wraps the inline calendar in a dialog with quick-select presets and an optional confirm action. The demo keeps the selected range in local state and reports callbacks; it does not fetch live rates from Mews.

*

Variants

Default (confirm variant)

The confirm variant shows a Confirm dates button that closes the dialog when a complete range is selected.

*

Unselected

The Unselected story demonstrates the empty state with no dates chosen.

External actions

The external-actions variant hides the confirm button and quick-select; the caller owns the commit/close flow.

*

Props

PropValuesNotes
variantconfirm, external-actionsconfirm shows quick-select + confirm button; external-actions delegates to caller
checkIn / checkOutISO date stringsControlled range; empty = unselected
dailyRatesRecord<string, DailyRate>Optional rate overlay for calendar cells
showQuickSelectbooleanShow quick-select presets (default: true in confirm variant)
onChange(checkIn, checkOut) => voidCalled when range changes
onClose() => voidCalled when dialog should close
onVisibleRangeChange(start, end) => voidReports visible calendar months for rate pre-fetch
triggerRefReact.RefObject<HTMLElement>Optional external trigger for focus return

DailyRate shape

interface DailyRate {
  amount: number;
  currency?: string;
  available?: boolean;
  minNights?: number;
  invalidStayLengths?: number[];
  restrictions?: RestrictionAdvisory[];
}

Accessibility

  • Dialog role with aria-label="Select dates of stay"
  • Calendar grid with role="grid" and column headers
  • Selected dates announced via aria-selected and aria-pressed
  • Escape key closes and returns focus to trigger
  • Month navigation via Previous/Next month buttons (keyboard accessible)
  • Disabled dates (before minDate) are crossed out and non-interactive; cached available: false dates remain selectable (advisory only — live Search validates availability)

Responsive behaviour

  • Dialog constrained to max-w-[760px] with horizontal padding
  • Calendar shows two months side-by-side on md and up; single month on smaller screens
  • Quick-select buttons wrap on narrow viewports
  • Touch targets meet 44×44 minimum

Usage

import { DateSearchDropdown } from '@/components/booking/search/DateSearchDropdown';

<DateSearchDropdown
  checkIn={range.checkIn}
  checkOut={range.checkOut}
  dailyRates={rates}
  onChange={(checkIn, checkOut) => setRange({ checkIn, checkOut })}
  onClose={onClose}
  onVisibleRangeChange={prefetchRates}
/>

View source · View calendar source