Interactive
Date picker
A popover calendar over a native date input: month and year menus, a keyboard grid (arrows, Home, End, Page Up and Page Down), min and max, disabled dates, and month names and week start from the locale. Needs monsoon.js.
Needs monsoon.js. The styles work on their own, and the behavior comes from the optional interactive layer: add <script src="https://cdn.jsdelivr.net/npm/monsooncss/dist/monsoon.js" defer></script> or import 'monsooncss/js'. See the interactive layer.
Example
<div class="grid gap-4 max-w-xs">
<div class="field">
<label class="label" for="dp-delivery">Delivery date</label>
<div class="datepicker" data-m-datepicker data-m-datepicker-disabled="sun">
<input type="date" id="dp-delivery" class="input" value="2026-10-16" min="2026-10-01" max="2027-03-31">
</div>
<p class="hint">Sundays are closed.</p>
</div>
<div class="datepicker" data-m-datepicker data-m-datepicker-locale="de-DE">
<input type="date" class="input input-sm" value="2026-11-03" aria-label="Termin">
</div>
</div>JavaScript API
Attribute
data-m-datepicker
Options
| Option | Description |
|---|---|
data-m-datepicker-locale="pt-BR" | |
data-m-datepicker-week-start="1" | |
data-m-datepicker-disabled="sat,sun,2026-12-25" | |
data-m-datepicker-presets="today,7d,30d,month" | |
min and max on the input |
Methods
| Method | Description |
|---|---|
Monsoon.datepicker(el).open() | |
Monsoon.datepicker(el).close() | |
Monsoon.datepicker(el).value | |
Monsoon.datepicker(el).value = "2026-10-20" |
Events
| Event | Description |
|---|---|
monsoon:change { value } | |
input and change on the native input |
Classes
11 classes. Click a name to copy it. Utilities on the same element always win over component defaults, so any of them can be adjusted with plain utility classes.
| Class | Type | What it does |
|---|---|---|
| Base | Base class of the date picker. On a <div> in the example. Sets flex display, alignment, gap, width, padding and hidden by default.CSS |
|
| Modifier | Modifier, combined with the datepicker class. Not used in the example above. Sets absolute position, offsets, grid display, alignment, width and text color.CSS |
|
| Modifier | Modifier, combined with the datepicker class. Not used in the example above. Sets fixed position, offsets, stacking order, margin, padding and overflow, and --tone and --tone-fg.CSS |
|
| Modifier | Modifier, combined with the datepicker class. Not used in the example above. Sets width.CSS |
|
| Modifier | Modifier, combined with the datepicker class. Not used in the example above. Sets flex display, alignment, gap, margin, width and padding.CSS |
|
| Modifier | Modifier, combined with the datepicker class. Not used in the example above. Sets generated content, width, height, background and transform.CSS |
|
| Modifier | Modifier, combined with the datepicker class. Not used in the example above. Sets generated content, width, height, background and transform.CSS |
|
| Modifier | Modifier, combined with the datepicker class. Not used in the example above. Sets width, border, height, padding, text size and font weight.CSS |
|
| Modifier | Modifier, combined with the datepicker class. Not used in the example above. Sets border, inline-grid display, alignment, width, height and text size.CSS |
|
| Part | Part of the date picker. On an <input> in the example. Sets block display, width, height, padding, text size and text style, and 9 custom properties.CSS |
|
| Modifier | Modifier, combined with the datepicker class. Not used in the example above. Sets block display, width, height, padding, text size and text style, and 9 custom properties.CSS |
Usage
The styles ship inside the same stylesheet as the utilities, and the behavior comes from the optional monsoon.js script, which enhances any element with a matching data-m attribute, including markup added later.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/monsooncss">
<script src="https://cdn.jsdelivr.net/npm/monsooncss/dist/monsoon.js" defer></script>
<!-- Date picker: start from the base class, then add modifiers -->
<div class="grid gap-4 max-w-xs">
<div class="field">
<label class="label" for="dp-delivery">Delivery date</label>
<div class="datepicker" data-m-datepicker data-m-datepicker-disabled="sun">
<input type="date" id="dp-delivery" class="input" value="2026-10-16" min="2026-10-01" max="2027-03-31">
</div>
<p class="hint">Sundays are closed.</p>
</div>
<div class="datepicker" data-m-datepicker data-m-datepicker-locale="de-DE">
<input type="date" class="input input-sm" value="2026-11-03" aria-label="Termin">
</div>
</div>Theme it with --seed on any ancestor, for example style="--seed: #0d9488", and force a scheme with class="dark" or class="light" on a wrapper.
Accessibility
- Give every control a visible
labellinked withfor, or anaria-labelwhen the purpose is obvious from context. Link help and error text witharia-describedby; invalid styles use:user-invalid, so they appear only after the user interacts. - Every interactive part shows a visible focus ring with
:focus-visible, and tone colors pair with-foregroundtokens that keep text at 4.5:1 or better in light and dark mode.