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.

Form Control Attributes

Attributes and events apply to the native form field; ref gives you access to it. For the container, use wrapperAttributes and wrapperRef.

Component Props

NameTypeDefaultDescription
wrapperRef bindableHTMLDivElement | nullThe DOM reference of the wrapper 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. When rendering on the server, give it the timeZone of the visitor: the calendar picks dates at the visitor's midnight, and the server would format them in its own time zone.
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.
ref bindableHTMLInputElement | nullThe DOM reference of the native date input that holds the value, as YYYY-MM-DD. The other attributes of the picker are applied to it.
buttonRef bindableHTMLButtonElement | nullThe DOM reference of the button that opens the calendar.
buttonPropsButtonPropsThe props to spread on the Button that opens the calendar.
wrapperAttributesHTMLAttributesThe attributes to spread on the wrapper element.
popupRef bindableHTMLDivElement | nullThe DOM reference of the calendar popup.
locale, blackoutDates, headers, minDate, maxDate, today, weekStart from CalendarViewProps
NativeFieldAttributes<HTMLInputAttributes>
Edit this Doc View as Markdown