Searching Puzzle Pieces

Type to search Puzzle Pieces.

Date Range Picker

A Field-shaped trigger and popover for start/end selection that composes the Calendar piece: a controlled { start, end } ISO value, in-between range shading with a live hover preview, optional-controlled open, one or two months, and an optional presets rail. It is parent-owned — it emits @change on each committed endpoint and the parent writes the range back down.

Pick a check-in and check-out day.

The first click sets the start and clears the end; the second sets the end (auto-ordered). While you choose the end, hovering previews the in-between band. A third click starts over.

Installation

Copy the range picker, the Calendar it composes, and the date helper they share:

puzzle add piece date-range-picker

date-math.js is a shared lib file — both pieces import it as ../../lib/date-math.js. Keep it in app/lib/.

Usage

import DateRangePicker from '@/components/ui/DateRangePicker.pzl';
<DateRangePicker label="Stay dates" hint="Pick a check-in and check-out day." value={ range } @change={ setRange } />

Two months

Presets

Bounds

Controlled open

Day snippet

One snippet, forwarded into both month grids — DateRangePicker declares no day marker of its own. Keep the content decorative: it is stamped inside the day button.

Error state

Please choose a start and end date.