Date picker
The guideline content on this page is synced with Figma and can be used as a source of truth.
Open in Figma
Date pickers allow users to choose a date or a range of dates.
Anatomy
- Label
- Mandatory (optional)
- Container
- Helper text
- Help label
- Info icon (optional)
States
- Enabled
- Hover
- Selected
- Error
- Error focused
- Disabled
- Read only
- Focused
Label
A label is mandatory for all text fields and should describe the field's purpose. Labels are included by default. If another element (such as a section title) already serves as a clear description, the default label can be visually hidden.
Helper text
Helper text communicates requirements and disclaimers below the field. An error message will always replace the helper text when a field validation error is triggered.
Required/optional fields
We use an asterisk to indicate a field is required.
The convention of using a red asterisk (*) in a label to denote a required field is a long-standing and widely adopted practice in User Experience (UX) and form design.
Max width
Dropdown buttons and menus have a max width of 520px.
Accessibility
Keyboard interaction
All buttons should be reachable via Tab and Shift+Tab keys. A visible focus indicator is shown on the focused control.
Specs
Developer reference
The following sections describe supported functionality that is not part of the Figma design specification.
Third-party plugin. The interactive date picker examples below are based on the Vue-based Buefy datepicker. Spiris ships CSS only — no JavaScript is bundled. To run these examples, consuming applications load vue.min.js and buefy.min.js alongside the Spiris stylesheet.
Variants
The date picker supports multiple layout and selection variants via Buefy:
Info icon
Wrap the <label> and an icon trigger in .label-with-info to place the info icon beside the label with the 8 px gap from the Figma anatomy. On hover or keyboard focus, the tooltip opens upwards (data-bs-placement="top") to reveal the supporting text.
Keep the trigger outside the <label for> so clicking the icon does not focus the input, and mirror the tooltip text into a visually-hidden element that the input references via aria-describedby — that way assistive tech users hear the same help text without depending on the tooltip.
Tooltip behaviour relies on Bootstrap's tooltip plugin (with Popper for positioning). See the Tooltips page for setup details.
With input
An input with a simple dropdown/modal for selecting a date.
Inline date picker — single selection
The date picker can be rendered inline (without an input trigger) for choosing a single date.
Inline date picker — range selection
Inline rendering with range selection — pick a start date and an end date. Dates in between are highlighted.
Range selection with input
Select a range of dates from an input trigger. Both start and end dates appear in the input once chosen.
Month and year selection
A compact picker that lets the user choose a month and a year without selecting a specific day.
Calendar cell variants
The calendar cell appearance can be customised with modifier classes on the date picker wrapper:
.datepicker-square— fill cell with square borders.datepicker-stroke.datepicker-square— stroke cell with square borders
Fill cell, square borders
Add .datepicker-square to the date picker wrapper.
Stroke cell, square borders
Add .datepicker-stroke and .datepicker-square to the date picker wrapper.