DatePicker allows a user to select a date or date range from a dropdown calendar.

Anatomy

  • Required
  • Optional
Anatomy elements
#RequiredElementDescription
1ContainerWrapper that includes the field, label, and assistive text.
2NoLabelDescribes what the date represents. Accepts rich content like icons or optional indicators.
3IconLeading calendar icon that identifies the field as a date picker.
4FieldDisplays the selected date or a placeholder, and opens the popover when activated. The field cannot be typed into.
5NoClear buttonResets the selection once the field has a value.
6NoAssistive textDisplays description or error text to aid the user.
7PopoverFloating panel that holds the selection controls while the DatePicker is open.
8HeaderShows the current selection at the top of the popover.
9NoPresetsList of common periods beside the calendar. Available on range types.
10CalendarMonth grid for choosing a date or the start and end of a range.
11NoTime panelInputs for the time and time zone, with a button to save the selection. Available on time types.

Guidelines

When to use

DatePicker allows users to select a specific date, range of dates, or a date and time from a dropdown calendar. Use a DatePicker when the value is a point or period on the calendar, such as a send date, a scheduled time, or the period a report covers.

DatePickers are most commonly used to filter reports and activity by date range, where presets offer quick access to common periods. They also schedule sends and set the timestamp a condition compares against.

Best practices

Date limits

Limit the calendar to the dates the user can actually choose. Dates outside the limits are disabled, which prevents an invalid selection instead of reporting it after the fact. Reporting filters, for example, rarely need dates after the current date.

Do: Disable dates that can't be selected.
Don't: Allow any date and report the problem afterward.

Labels and placeholders

While not explicitly required, we highly recommend providing a visible label so users understand what the date represents. A DatePicker that filters a report usually sits in a toolbar, where a visible label competes with the controls around it. In those placements, provide an accessible label in place of a visible label.

Do: Include a visible label that describes what the date represents.
Don't: Use placeholders in place of visible labels.

Ranges

Use a single range DatePicker when the user needs both a start and an end date. One field keeps the period together, shows both ends in the same calendar, and prevents an end date that falls before the start. Reserve separate DatePickers for filters where either end is optional.

Do: Select a period with one range DatePicker.
Don't: Split a required period across two DatePickers.

Customization

In adhering with Pluma's focus on flexibility, the DatePicker component includes customization options beyond plain text. Customization is useful for adding richer label content, building custom assistive text, or tailoring the presets to the data on the page.

Custom description

Descriptions are assistive text that display below the field. They can accept rich content including links.

Custom description with link

A description with an inline link directs users to additional resources.

Custom error

Error messages are assistive text that display below the field. They accept rich content, allowing the inclusion of links or formatted text that better help users resolve the issue.

Error with link

An error message with a link directs users to relevant documentation or support.

Custom label

The label accepts rich content, allowing supplementary elements such as optional indicators alongside the label text.

Label with optional text

Supplementary text clarifies that the field is not required.

Custom presets

Range types can replace the default presets with a list that matches the data on the page. Each preset can include an icon and a tooltip to explain what the period covers or why it's unavailable.

Presets with tooltip

A tooltip explains a limit on the period without lengthening the preset label.

Types

Date

A single date can be selected by default.

Date range

A date range allows for a start date and end date.

Date and time

Adding time selects a single moment in a chosen time zone.

Date and time range

A date and time range offers the most granular selection of a specific timeframe.

Appearance

Presets

Range types can show a list of presets beside the calendar for common periods, such as the last 7 or 30 days. Show presets wherever users return to the same, consistent periods often. Time ranges also include shorter periods, such as the last hour.

Presets

Presets allow quick access to commonly used time periods.

No presets

Omit presets for ranges that rarely repeat, leaving only the calendar in the popover.

Sizes

DatePickers are available in two sizes, medium and small. Medium is the default.

Medium

Medium is suitable for most forms.

Small

Small suits toolbars and filter rows where the DatePicker sits beside other small controls.

Behaviors

States

Base

The DatePicker has default input styling in its base resting state.

Hover

Border color updates on mouse hover to signal the field is interactive.

Focus

On keyboard focus, the field receives the standard 2px focus ring and the border color updates.

Active

Active styles apply while the popover is open.

Disabled

Disabled fields cannot be interacted with. Background and text color update to indicate the field is unavailable.

Critical

The DatePicker adopts critical styling to indicate there's an error. An error message displays below the field when set.

Clear button

A clear button can be enabled to reset the selection. Enable it when an empty field is a valid choice, such as an optional filter that shows all dates when cleared. The button is hidden when the field is empty.

Clear button

The clear button resets the field and anything it filters.

Date limits

A DatePicker can set the earliest and latest dates the user can choose, or disable individual dates. Disabled dates can't be selected in the calendar, and presets whose period falls outside the limits are disabled as well.

Latest date

Dates after today are disabled, so only past periods can be selected.

Earliest date

Dates before today are disabled, so only future dates can be scheduled.

Opening and closing

The popover opens when the field is clicked or receives focus, or when the user presses Down Arrow, Enter, or Space. Pressing Escape or clicking outside the popover closes it without changing the value.

Date and date range types apply the selection and close as soon as the user picks a day, the end of a range, or a preset. Time types hold the selection until the user saves it, so the date, time, and time zone can be adjusted together before the field updates.

Close on selection

Picking a day updates the field and closes the popover.

Close on save

Changes to the date, time, and time zone update the field only after they're saved.

Range length

Range types can require a minimum or maximum length. For date ranges, days that would make the range too short or too long are disabled once the start date is chosen. For time ranges, an error explains the limit and saving is unavailable until the range fits.

Minimum length

Days that would make the range shorter than the minimum are disabled once a start date is chosen.

Maximum length

Days that would make the range longer than the maximum are disabled once a start date is chosen.

Time zones

Time types include a time zone selector, which defaults to the user's local time zone. Changing the time zone keeps the chosen time on the clock and moves the moment it represents. Unix timestamps can also be entered.

Time zone

The time zone can be selected without the day or time updating.

Content

Assistive text

Assistive text displays below the DatePicker and gives the user information about the date they're choosing. Assistive text comes in different forms including descriptions and error text.

Description

Use description text to explain how the date is used or what limits apply to it. Use short, complete sentences.

Do: Explain how the date is used.

Error

Error messages communicate issues the user must resolve before submission. Frame errors as direct instructions that name the dates the user can choose instead. Keep messages direct and concise. Avoid using "Please".

Do: Name the dates that can be chosen.
Don't: Use vague error messages.

Labels

Write clear, concise labels that describe what the date represents, not that it's a date. Use nouns and noun phrases.

Do: Describe what the date represents.
Don't: Label the field with the data type alone.

Placeholders

Placeholders help the user complete a field by describing what information it expects. For the DatePicker, we recommend short phrases such as "Choose a date" or "Select a range". When the field is optional, the placeholder can describe what an empty field means instead.

Do: Use placeholders that describe the date the field expects or what leaving it empty means.
Don't: Show a format hint for a field that can't be typed into.

Presets

Preset labels name the period relative to today. Keep labels parallel so the list scans as a set, and order them from the shortest period to the longest.

  • Last 7 days
  • Last 30 days
  • Last 90 days
Do: Use parallel labels ordered by length of period.
  • This week
  • Past 30 days
  • Quarter (90d)
Don't: Mix phrasing and units across presets.