Searching Puzzle Pieces

Type to search Puzzle Pieces.

Date Picker

A Field-shaped trigger and popover that composes the Calendar piece: a controlled ISO value, a locale-aware trigger label, label / hint / error, and an optional trigger↔panel morph. It is parent-owned — it forwards Calendar's @change up, closes, and returns focus to the trigger.

We deliver Monday through Friday.

DatePicker composes the Calendar piece inside a popover and auto-flips it above the trigger when the trigger sits near the bottom of the viewport.

Installation

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

puzzle add piece date-picker

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

npm install @magic-spells/morph-engine

Required: DatePicker imports @magic-spells/morph-engine statically.

Usage

import DatePicker from '@/components/ui/DatePicker.pzl';
<DatePicker label="Ship date" hint="We deliver Monday through Friday." value={ shipDate } @change={ setShipDate } />

Error state

Please choose a date.

Morph

Bounds

Day snippet

DatePicker declares no day marker of its own — it forwards the snippet straight into the Calendar it composes. Keep the content decorative: it is stamped inside the day button.

Formats