Overview
Three layers: .calendar-day cells, a .calendar grid, and .date-picker which wraps a field + trigger + panel. Panel visibility uses .date-picker--open. There is no bundled DatePicker runtime in the npm package: only styles and the HTML contract below.
| Layer | Class | Role |
|---|---|---|
| Day | .calendar-day | Day button or weekday/blank cell |
| Grid | .calendar | Month view with header and weeks |
| Picker | .date-picker | Label, field, trigger, optional panel |
Prerequisites
- PimentCSS installed, Installation.
- Input fields,
.label,.field,.field-groupfrom Input fields. - Focus,
:focus-visiblerings on days and nav buttons.
Calendar days
Days are <button type="button"> except weekday headers and leading blanks (span). Modifiers --selected, --current, --disabled, and doc-only --hover / --focus show spec states.
Day states (spec)
Static modifiers for documentation; interactive days use real buttons below.
- Default
- Current
- Selected
- Hover (spec)
- Focus (spec)
- Disabled
- Weekday M
- Blank
Calendar
Stack header (month + optional prev/next), weekday row, then .calendar__week rows. Max width 240px, 12px padding, 8px gap between cells.
<div class="calendar" role="application" aria-label="May 2026">
<div class="calendar__header">…</div>
<div class="calendar__weekdays">…</div>
<div class="calendar__weeks">
<div class="calendar__week">…</div>
</div>
</div>
Full month example
May 2026
Behavior in your app
Copy and adapt the script in docs-site/src/lib/date-picker-behavior.ts after PimentCSS CSS is loaded. It toggles the panel, renders months from the current month forward (previous month disabled), disables past days in the current month, and closes on Escape or outside click.
// See docs-site/src/lib/date-picker-behavior.ts (month nav, min = current month, field-group layout).
Date picker
Combines .field-group, readonly text input, calendar trigger button, and .date-picker__panel. Add .date-picker--open (via JS) to reveal the panel. Demos on this page are wired with the script above.
<div class="date-picker date-picker--open">
<div class="date-picker__body">
<div class="field-group">…</div>
<div class="date-picker__panel">
<div class="calendar" role="dialog">…</div>
</div>
</div>
<p class="date-picker__hint">dd/mm/yyyy</p>
</div>
Example (closed)
Click the calendar button to open the panel, then pick a day. Requires the behavior script (included on this docs site).
May 2026
Pick a date
Open state (spec)
Markup with date-picker--open for screenshots; the same script can toggle it closed.
May 2026
Pick a date
Class reference
| Class | Description |
|---|---|
.calendar-day | Day cell (button or span) |
.calendar-day--selected | Chosen day |
.calendar-day--current | Today outline |
.calendar-day--disabled | Unavailable day |
.calendar-day--weekday | Column header (S–S) |
.calendar-day--blank | Leading/trailing empty cell |
.calendar | Month grid container |
.calendar__nav | Previous / next month control |
.date-picker | Field + panel wrapper (240px max) |
.date-picker--open | Shows .date-picker__panel |
.date-picker__trigger | Opens calendar (pair with aria-expanded) |
.date-picker__hint | Format hint below field |
Customize (Sass)
-
Calendar sizing
Override picker width and cell size before importing components.@use "pimentcss-design-system" with ( $date-picker-width: 16rem, $calendar-day-size: 1.625rem, $calendar-gap: 0.375rem ); -
Rebuild CSS
Run after editing _date-picker.scss or tokens.npm run build:css
Accessibility (RGAA / WCAG)
Date selection
- Label,
<label for="…">on the date field; hint viaaria-describedbywhen needed. - Trigger,
aria-haspopup="dialog",aria-controls,aria-expandedsynced with open state. - Calendar,
role="dialog"(orapplicationfor standalone grid) with an accessible name. - Days, use
<button>with visible day number; disable unavailable days withdisabled. - Keyboard, arrow keys and Escape require app logic; CSS provides focus rings only.
- Selected state, expose the chosen date in the input value (and optionally
aria-liveon change).