Date-picker component overview
Use a date picker when the interface benefits from visual date selection or date validation. If users need to enter very flexible freeform dates or work with a tiny, predictable set of choices, a simpler input or select may be more appropriate.
When to use
Use date pickers when
- Users need to select a specific date with high accuracy
- A calendar view makes the choice faster than typing
- You need to limit dates with min/max rules or disabled dates
- The task involves travel dates, appointments, deadlines, or availability
Do not use date pickers when
- The date can be entered more efficiently with a simple text field
- The range of valid dates is so small that a select or radio group is clearer
- Users need to enter partial, approximate, or highly flexible date values
- The interaction would be unnecessarily heavy for the task
Patterns
Anatomy
Date-picker component anatomy
Design guidelines
1
Choose the simplest selection mode
Start with
single when one date is enough. Use range only when people need both a start and end date, and use multi only for truly non-consecutive selections.2
Keep labels and format expectations clear
Write labels that describe the task directly, such as “Arrival date” or “Travel dates”. Make sure the displayed format and first day of week match the product locale.
3
Use calendar rules to prevent bad choices
Apply
min, max, isDateDisallowed, and validation states when business rules are known, so people are guided before they submit the form.For
range and most multi scenarios, showing two months at once usually makes comparison easier and reduces selection errors.Usage
Default
Use the defaultsingle type when users need to choose one date. This is the best starting point for appointments, due dates, deadlines, and similar tasks.
Users can also enter a date manually. After pressing Tab, the component formats the value and reflects it in the calendar view.The wire format of the
value attribute — and of min/max — depends on precision:
day uses YYYY-MM-DD, month uses YYYY-MM, and year uses YYYY. For type="range" two tokens are joined with / (start/end); for type="multi" tokens are space-separated.Supported input formats include:- ISO format:
2024-05-30 - Text format:
30 May 2024,May 30, 2024,30 January 2024,January 1, 1970(locale-aware) - Numeric format:
30/05/2024,05-30-2024,30.05.2024,05.30.2024(with day/month heuristics)
Date range
Usetype="range" when users need a start and end date. Set months="2" so both months are visible in the panel and months-per-view="months" so navigation advances the full visible range.
Multiple dates
Usetype="multi" when users need to pick several non-consecutive dates. Unlike the single-date picker, the panel stays open while users continue selecting.
Options
Month selection
Useprecision="month" when the task needs a month rather than a specific day, such as choosing a billing cycle. Month precision stores values as YYYY-MM and opens directly in the month view.
Year selection
Useprecision="year" when users choose a whole year, such as a graduation year. Year precision stores values as YYYY and opens directly in the year view.
Calendar starting view
Useinitial-view with day precision when people need to start their search from months or years. The picker still stores a full YYYY-MM-DD value after users complete the selection.
Disabled
Usedisabled when the date field should not be interactive, such as when access is restricted based on user permissions or form state.
Validation states
Usevalidation-status when the field should show immediate visual feedback after validation.
Label with optional text
Use an optional indicator when the date adds context but is not required to complete the form.Label with info tooltip
Combine the label slot with a tooltip when users may need a short explanation before selecting a date.Locale
Uselocale to match date formatting and calendar conventions to regional expectations.
First day of week
Usefirst-day-of-week to align the calendar grid with regional or business expectations.
Show outside days
By default, the calendar shows only the days of the displayed month. Enableshow-outside-days when the additional context is helpful.
Disallowed dates
UseisDateDisallowed to make specific dates unavailable for selection. This is useful for holidays, sold-out inventory, blackout periods, or policy restrictions.
Custom display format
UseformatOptions to customize the display format of the selected date in the input field. This does not affect the underlying value, which is always stored as YYYY-MM-DD.
Form integration
bq-date-picker submits its current date value with the form. Use required and form-validation-message when the date is mandatory; the custom message also applies to invalid typed values and out-of-bounds dates.
Best practices
DoUse clear, task-specific labels like “Arrival date” or “Travel dates” so users know exactly what they are selecting.
Don’tDo not overcomplicate the field label or ask for extra date information that the task does not need.
DoUse a single combined input when possible. It keeps the interaction simpler and easier to scan.
Don’tDo not split day, month, and year into separate inputs unless the use case truly requires it.
DoDisable unavailable dates when the business rules are known, instead of letting users submit invalid choices.
Don’tDo not rely on placeholder text as the only instruction or explanation for the field.
DoShow two months for range selection when comparison matters, so people can understand the interval more easily.
Don’tDo not use a heavier multi-date or range pattern when one simple date field would solve the task.
Accessibility
bq-date-pickeris form-associated and delegates focus, so it participates in native forms and moves focus into the internal<input>element when the component receives focus.- The input element sets
aria-disabled="true"whendisabledistrue. It setsaria-invalid="true"forvalidationStatus="error"and native constraint failures such as required, invalid, or out-of-bounds values. - The input uses
aria-haspopup="dialog"andaria-controlsto announce the calendar panel. Alabelslot suppliesaria-labelledbyfor both the input and calendar panel. - The calendar panel carries
role="dialog"and is labelled viaaria-labelledbywhen a label is present, or by its built-in “Date picker” label otherwise. The panel is not modal. - The component emits
bqFocus,bqBlur,bqChange, andbqClear, which give you the hooks needed to announce validation results, react to changes, and keep form state synchronized. - Keyboard users can open the calendar panel with
EnterorSpace, navigate days with the arrow keys, and close the panel withEscape. - Always provide a visible label through the
labelslot. Without it, the input has no programmatic label, so nearby context must provide an equivalent accessible name. - Validation states should never rely on color alone. Pair
validationStatuswith visible error text so screen reader users receive the same feedback as sighted users. - Keep
locale,first-day-of-week, and display formatting aligned with user expectations so typed input and visible values remain understandable for all users.
API reference
Properties
Events
- In React, prefix events with
on:onBqBlur,onBqChange,onBqClear,onBqFocus,onBqViewChange. - In Angular, use the event binding syntax:
(bqBlur),(bqChange),(bqClear),(bqFocus),(bqViewChange). - In Vue, use the
@shorthand:@bqBlur,@bqChange,@bqClear,@bqFocus,@bqViewChange.
Methods
Slots
Shadow parts
CSS custom properties
Resources
Interactive playground
Explore date picker variants, validation, locale, and panel behavior in Storybook.
Source code
Browse the component implementation, styles, and tests on GitHub.