dateMetadataProvider
A function that provides metadata for the dates the calendar is about to render: whether they are disabled, and CSS part names for styling from outside using the ::part() selector. Unlike isDateDisabled, which is called once per date, the metadata provider is called for a range of dates at a time, and again as the calendar renders further dates.
It receives a DatePickerDateRange and returns an array of DatePickerDateMetadata objects for the dates in that range that have metadata. It can return a Promise to load the metadata asynchronously, and null or undefined when no date in the range has metadata.
The returned array has the following structure:
[
// The date is an ISO 8601 string.
{ date: '2026-01-01', disabled: true },
// Adds a custom part name to the date.
{ date: '2026-01-02', part: 'busy' },
]A date is disabled if its metadata marks it disabled, or isDateDisabled returns true, or it is outside min and max. Disabled dates are not selectable, and typing a disabled date in the field makes it invalid. The provider does not affect which date is focused when opening the overlay. Use initialPosition property to provide a selectable date.
While a returned Promise is pending, the dates it covers are not disabled yet and render with the loading part. If the function throws or rejects, corresponding dates are requested again the next time the user navigates.
The provider is used for validation also when the overlay is closed. Date is considered valid while the provider is pending, and is re-validated again after the metadata is loaded.
Keep a stable reference to the function: assigning a new one clears the cache and re-fetches visible range. Call clearCache() to re-fetch when the data behind the same function changed.