base-ui icon indicating copy to clipboard operation
base-ui copied to clipboard

Calendar And Date Fields primitives

Open peter-emad99 opened this issue 8 months ago • 7 comments

Feature request

Provide Headless Primitives for Calander and Date Fields

Examples in other libraries

https://ark-ui.com/react/docs/components/date-picker https://react-spectrum.adobe.com/react-aria/Calendar.html

Motivation

it will be great to have this built in

peter-emad99 avatar Apr 12 '25 20:04 peter-emad99

Would be cool to have one with features from MUI X but unstyled.

lanzclintonv avatar May 03 '25 03:05 lanzclintonv

@lanzclintonv Which features in particular do you want?

colmtuite avatar May 05 '25 09:05 colmtuite

@lanzclintonv Which features in particular do you want?

All the standard features such as limiting the dates (start and end date), and the ability to disable some dates (or a date range).

Most importantly, month and year views when navigating through other dates. This makes the date picker be a month picker and a year picker too.

In addition, rendering multiple months too.

I believe all of these can be done as a headless component. In fact, Zag has already made one.

lanzclintonv avatar May 06 '25 08:05 lanzclintonv

I started working on a Calendar component for the Base UI team in #1973

I'll use this issue to list things that needs to be done around this line of components:

Planned work

  • [ ] Create a Calendar component with only day editing (#1973)
  • [ ] Create a Range Calendar component with only day editing
  • [ ] Create one or several field components to support date, time, date time, date range, time range and date time range edition
  • [ ] Create the documentation for UTC and timezone usage (equivalent of this MUI X page)
  • [ ] Create the documentation for date format and localization (equivalent of this MUI X page)
  • [ ] Create the documentation for the Calendar systems if we want to keep supporting them (equivalent of this MUI X page)

To be decided

  • [ ] Create a Date Picker component (we need to determine what the added value of this component compared to only using Date Field and Calendar inside a Popover)
  • [ ] Create a Date Range Picker (same concerns as for the Date Picker)
  • [ ] Add month and year editing to the Calendar component

flaviendelangle avatar Jun 04 '25 09:06 flaviendelangle

When you say day editing ..it includes year and months also ? Should we have support for selecting time also in calendar component ?

peter-emad99 avatar Jun 11 '25 14:06 peter-emad99

When you say day editing ..it includes year and months also ?

No, I'll add those in the "to be decided", we are currently debating the added value of dedicated primitives for month and year editing compared to directly using a Select or a ListBox (when available)

flaviendelangle avatar Jun 11 '25 14:06 flaviendelangle

Should we have support for selecting time also in calendar component ?

It wouldn't be in the Calendar component. We could consider having a component for time editing, but we want to cover the Calendar and the Field before 👍

flaviendelangle avatar Jun 11 '25 15:06 flaviendelangle

It would be great as this is implemented if we could have built-in support for Temporal, or at least an adapter.

nickhall avatar Aug 21 '25 16:08 nickhall

Temporal is still in experimental stage with only Firefox supporting it. AFAIK, Luxon plans to use Temporal under the hood, when it is widely supported. I wouldn't be surprised if date-fns would do something similar. Hence, the landscape is slightly unclear about what would actually be needed from such solutions until it is more widely adopted.

LukasTy avatar Sep 09 '25 15:09 LukasTy