enes

Date Picker AI

The Date Picker lets users select a date from carousel-style day, month and year columns. Its value uses the YYYY-MM-DD format, and any column can be hidden to build, for example, a month and year only picker.

Usage

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

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

<DatePicker bind:value />

Date Format

Use the format prop to switch between dd/MM/yyyy and MM/dd/yyyy.

Hiding Columns

Use hideDays, hideMonths or hideYears to hide individual selector columns, for example to build a month and year only picker.

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
value bindablestring''Selected date as YYYY-MM-DD (matches the underlying <input type="date">).
format'MM/dd/yyyy' | 'dd/MM/yyyy''dd/MM/yyyy'The order the three columns are laid out in.
open bindablebooleanfalseControls the open state of the picker.
hideYearsbooleanfalseRemoves the year column.
hideMonthsbooleanfalseRemoves the month column.
hideDaysbooleanfalseRemoves the day column.
minYearnumberCurrent - 100The first year offered by the year column. Unless min is given, the native input accepts no earlier date.
maxYearnumberCurrent + 100The last year offered by the year column. Unless max is given, the native input accepts no later date.
disabledDatesDate[][]Specific days (year-month-day) that cannot be selected.
disabledMonthsDate[][]Specific months (by month + year) that cannot be selected.
disabledYearsDate[][]Specific years (by year) that cannot be selected.
ref bindableHTMLInputElement | nullThe DOM reference of the native date input that holds the value. The other attributes of the picker are applied to it.
buttonRef bindableHTMLButtonElement | nullThe DOM reference of the button that opens the picker.
buttonAttributesHTMLButtonAttributesThe attributes to spread on the button that opens the picker.
wrapperRef bindableHTMLDivElement | nullThe DOM reference of the element wrapping the button and the native input.
wrapperAttributesHTMLAttributesThe attributes to spread on the wrapper element.
popupLabelstring'Choose a date'The accessible name of the popup, which is announced as a dialog.
columnLabels{ month?: string; day?: string; year?: string }{ month: 'Month', day: 'Day', year: 'Year' }The names of the month, day and year columns: shown on the trigger while there is no date, and given to the lists of the popup.
NativeFieldAttributes<HTMLInputAttributes>
Edit this Doc View as Markdown