Date picker
Pick one date from a calendar: due dates, birthdays, bookings. Put a date field in .datepicker with data-momo-datepicker. The field stays in the form; momo.js turns it into a button and a month. Without JavaScript the plain date field still works.
Basic
Tap the button, tap a day: it is picked and the calendar closes. Today has a ring. Clicking outside or Esc closes it without changes.
<div class="cluster gap-4 items-start">
<div class="form-field w-64">
<label class="form-label" for="dp-due">Due date</label>
<div class="datepicker" data-momo-datepicker>
<input type="date" id="dp-due" name="due">
</div>
</div>
<div class="form-field w-64">
<label class="form-label" for="dp-birthday">Birthday</label>
<div class="datepicker" data-momo-datepicker>
<input type="date" id="dp-birthday" name="birthday" value="1994-06-18">
</div>
</div>
</div>Quick dates and limits
data-presets adds one-tap choices: today, tomorrow, week (in a week), nextweek (next Monday), yesterday. min and max on the field cross out the days you cannot pick. data-placeholder sets the empty text.
Up to the end of January.
<div class="form-field w-64">
<label class="form-label" for="dp-delivery">Delivery</label>
<div class="datepicker" data-momo-datepicker data-presets="today,tomorrow,nextweek" data-placeholder="When should it arrive?">
<input type="date" id="dp-delivery" name="delivery" min="2026-11-30" max="2027-01-31">
</div>
<p class="form-hint">Up to the end of January.</p>
</div>Several dates
data-momo-datepicker="multiple" on a text field picks any number of separate days: delivery days, days off, the dates of a course. A tap adds a day and a second tap takes it away; "Done" saves. The field holds the dates joined by commas.
Saved as: 2026-12-04,2026-12-11
<div class="form-field w-64">
<label class="form-label" for="dp-multi">Delivery days</label>
<div class="datepicker" data-momo-datepicker="multiple" data-today="2026-12-01" id="dp-multi-box">
<input type="text" id="dp-multi" name="days" value="2026-12-04,2026-12-11">
</div>
<p class="form-hint">Saved as: <code id="dp-multi-out">2026-12-04,2026-12-11</code></p>
</div>
<script>
document.getElementById('dp-multi-box').addEventListener('momo:date', function (e) {
document.getElementById('dp-multi-out').textContent = e.detail.values.join(',') || '(none)';
});
</script><div class="datepicker" data-momo-datepicker="multiple">
<input type="text" name="days" value="2026-12-04,2026-12-11">
</div>
<script>
box.addEventListener('momo:date', (e) => console.log(e.detail.values)); // ["2026-12-04", "2026-12-11"]
</script>Inline
.datepicker-inline shows the month in the page with no button. A tap saves the day.
<div class="datepicker datepicker-inline" data-momo-datepicker aria-label="Event day">
<input type="date" name="event" value="2026-12-12">
</div>Sizes and states
Classes on the field carry over to the button: form-control-sm, form-control-lg, is-invalid, is-valid, and disabled.
<div class="cluster gap-4 items-start">
<div class="datepicker w-56" data-momo-datepicker aria-label="Small"><input type="date" class="form-control-sm"></div>
<div class="datepicker w-56" data-momo-datepicker aria-label="Large"><input type="date" class="form-control-lg" value="2026-12-01"></div>
<div class="datepicker w-56" data-momo-datepicker aria-label="Disabled"><input type="date" disabled></div>
</div>Keyboard
| Key | Does |
|---|---|
| ↓ on the button | Opens it on the picked day (or today) |
| Arrows | Move a day or a week |
| Home / End | Start or end of the week |
| PgUp / PgDn | A month back or forward (with Shift: a year) |
| Enter / Space | Picks the day and closes |
| Esc | Closes without changes |
JavaScript
Momo.datepicker.get('#dp-due'); // "2026-12-24" or ""
Momo.datepicker.set('#dp-due', '2026-12-24'); // "" clears it
Momo.datepicker.open('#dp-due');
document.addEventListener('momo:date', (e) => console.log(e.detail.value));The field fires input and change too. Other options on the box: data-week-start="0" starts weeks on Sunday, data-locale="fr" changes the language (default: the page language). On phones the calendar opens as a bottom sheet.
Need a start and an end? Use the Date range.