enes

Calendar Date Picker

The Calendar Date Picker pairs a button trigger with a Calendar View popup. Clicking the trigger opens the calendar, and selecting a day updates the bound value and closes the popup.

Usage

<script>
	import { CalendarDatePicker } from 'fluentui-svelte';

	let value = $state(null);
</script>

<CalendarDatePicker bind:value />

Component API

The Calendar Date Picker builds on Calendar View, so calendar props such as blackoutDates, minDate, maxDate, weekStart and headers are forwarded straight to the popup calendar. You can see the full list in the Component Props section below.

Component Props

NameTypeDefaultDescription
ref bindableHTMLDivElementThe DOM reference of the picker element.
value bindableDate | nullnullThe selected date.
formatIntl.DateTimeFormatOptions{ year: 'numeric', month: 'numeric', day: 'numeric' }The options used to format the date rendered on the trigger.
calendarPositionPartial<ComputePositionConfig>The floating UI configuration object of the calendar popup. Keys left out keep their default.
onChange(event: Event, value: Date | null) => voidCalled whenever the selected date changes.
popupLabelstring'Choose a date'The accessible name of the calendar popup, which is announced as a dialog.
triggerRef bindableHTMLButtonElementThe DOM reference of the trigger button.
popupRef bindableHTMLDivElementThe DOM reference of the calendar popup.
locale, blackoutDates, headers, minDate, maxDate, weekStart from CalendarViewProps
Element Attributes (div)