Skip to main content
PimentCSS v1.0.1, what's new
Home

Date picker

Calendar panel, month navigation, and field-group layout.

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.

LayerClassRole
Day.calendar-dayDay button or weekday/blank cell
Grid.calendarMonth view with header and weeks
Picker.date-pickerLabel, field, trigger, optional panel

Prerequisites

  • PimentCSS installed, Installation.
  • Input fields, .label, .field, .field-group from Input fields.
  • Focus, :focus-visible rings 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.

Full month example

May 2026

S M T W T F S

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.

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.

Example (closed)

Click the calendar button to open the panel, then pick a day. Requires the behavior script (included on this docs site).

Pick a date

Open state (spec)

Markup with date-picker--open for screenshots; the same script can toggle it closed.

Pick a date

Class reference

ClassDescription
.calendar-dayDay cell (button or span)
.calendar-day--selectedChosen day
.calendar-day--currentToday outline
.calendar-day--disabledUnavailable day
.calendar-day--weekdayColumn header (S–S)
.calendar-day--blankLeading/trailing empty cell
.calendarMonth grid container
.calendar__navPrevious / next month control
.date-pickerField + panel wrapper (240px max)
.date-picker--openShows .date-picker__panel
.date-picker__triggerOpens calendar (pair with aria-expanded)
.date-picker__hintFormat hint below field

Customize (Sass)

  1. 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
    );
  2. 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 via aria-describedby when needed.
  • Trigger, aria-haspopup="dialog", aria-controls, aria-expanded synced with open state.
  • Calendar, role="dialog" (or application for standalone grid) with an accessible name.
  • Days, use <button> with visible day number; disable unavailable days with disabled.
  • 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-live on change).

Next steps