Skip to content
IndexRequest a UIAboutContact

Date Range Picker

A month calendar where two clicks pick a start and an end, with a hover preview and arrow-key navigation.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Clean UI design of a single-month calendar for choosing a stay: a white rounded card with the month name and small previous and next arrows, a seven-column grid of day numbers, two selected days with solid dark circles and a light grey band joining the days between them with rounded ends, a summary line below reading 5 nights, 9 to 14 March, thin border, flat modern style. Variants: only the start selected, and no selection. Negative: heavy shadows, gradients, text errors, clutter. Reduced motion: static design.

About this pattern

Definition

A range picker turns two choices into one gesture on a calendar: the first click sets the start, moving the pointer previews the range, the second click sets the end. The selected days are joined by a continuous band so the span reads at a glance.

Purpose & UX principles

  • The first click starts a new range; the second completes it; if the second date is earlier, swap them.
  • Preview the range on hover; shade days between start and end with a band and round the ends.
  • Show the result in words: number of nights and the dates.

Interaction states

  • A month grid, arrows to change month, a summary line and a Clear button.

Motion specification

  • The band follows the hover instantly.
  • Reduced motion: nothing to change.

Responsive behaviour

  • Make it keyboard operable: arrow keys move by day and week, Enter selects.
  • Disable past dates clearly and do not rely on colour alone.

Code

HTML
<div class="bx"><div class="cal"><div class="hd"><button type="button" class="ar" id="pm" aria-label="Previous month">&#8249;</button><b id="mt"></b><button type="button" class="ar" id="nm" aria-label="Next month">&#8250;</button></div><div class="wk" aria-hidden="true"><span>Mo</span><span>Tu</span><span>We</span><span>Th</span><span>Fr</span><span>Sa</span><span>Su</span></div><div class="dy" id="dy" role="grid" aria-label="Choose dates"></div></div><div class="ft"><span class="out" id="out" role="status">Pick a start date.</span><button class="mini" id="cl" type="button">Clear</button></div></div>

Related patterns

Heatmap Calendar

↗
Heatmap CalendarData Visualization

Segmented Control

↗
Segmented ControlInputs & Forms

Validation States

↗
Validation StatesInputs & Forms