Options

type support

You can import a type from svelte-flatpickr-plus/types by default it will export all options in a table below, for additional you can import Hook type for using it in callback of hook or event

Year dropdown default

By default a year dropdown will set maximum year as next year

In this page will have all options that you can passing into a action that you imported

Config OptionDefaultTypeDescription
allowInputfalseBooleanAllows the user to enter a date directly input the input field. By default, direct entry is disabled.
allowInvalidPreloadfalseBooleanAllow preloading of invalid date.
altFormat"F j, Y" / "F Y" (for monthPicker)StringExactly the same as date format, but for the altInput field.
altInputfalseBooleanShow the user a readable date (as per altFormat), but return something totally different to the server.
altInputClassnullStringThis class will be added to the input element created by the altInput option. Note that altInput already inherits classes from the original input.
ariaDateFormat"F j, Y" / "F Y" (for monthPicker)StringDefines how the date will be formatted in the aria-label for calendar days, using the same tokens as dateFormat. If you change this, you should choose a value that will make sense if a screen reader reads it out loud.
autoFillDefaultTimetrueBooleanWhether the default time should be auto-filled when the input is empty and gains or loses focus.
clickOpenstrueBooleanWhether clicking on the input should open the picker. Set it to false if you only want to open the calendar programmatically.
closeOnSelecttrueBooleanWhether calendar should close after date selection.
conjunction", "StringIf "mode" is "multiple", this string will be used to join selected dates together for the date input value.
dateFormat"F j, Y" / "F Y" (for monthPicker)StringA string of characters which are used to define how the date will be displayed in the input box. ( See supported format )
defaultDatenullDate, string, numberThe initial selected date(s).
defaultHour12NumberInitial value of the hour element, when no date is selected.
defaultMinute0NumberInitial value of the minute element, when no date is selected.
defaultSeconds0NumberInitial value of the seconds element, when no date is selected.
disable[]Date, string, number, functionDisables certain dates, preventing them from being selected. ( See detail of enabling & disabling dates )
disableMobiletrueBooleanSet this to true to always use the non-native picker on mobile devices. (By default is set to true to off a mobile mode for working with month plugin & year dropdown plugin)
enable[]Date , string , number , functionDisables all dates except these specified. ( See detail of enabling & disabling dates )
enableSecondsfalseBooleanEnables seconds selection in the time picker.
enableTimefalseBooleanEnables the time picker.
inlinefalseBooleanDisplays the calendar inline.
isMonthPickerfalseBooleanSet this to true will change a date picker into a month picker.
locale"default"LocaleKey , Partial<CustomLocale>The locale, either as a string (e.g. "ru", "en") or as an object. ( See Localization )
maxDatenew Date(new Date().getFullYear() + 1, 11, 31)Date, string, numberThe maximum date that a user can pick to (inclusive) and this will extended a maximum year you can select in year dropdown if it greater than next year.
maxTimenullDate, string, numberThe maximum time that a user can pick to (inclusive).
minDatenullDate, string, numberThe minimum date that a user can start picking from (inclusive).
minTimenullDate, string, numberThe minimum time that a user can start picking from (inclusive).
minuteIncrement5numberAdjusts the step for the minute input (incl. scrolling).
mode"single""single", "multiple", "range", "time"Date selection mode.
monthSelectorType"dropdown""dropdown", "static"How the month selector in the calendar should be shown.
position"auto""auto", "above", "below", "auto left", "auto center", "auto right", "above left", "above center", "above right", "below left", "below center", "below right"How the calendar should be positioned with regards to the input.
positionElementundefinedHTMLElementThe element to use as the position reference for the calendar.
shorthandCurrentMonthfalseBooleanEnables the use of shorthand for the current month.
staticfalseBooleanEnables the calendar to be displayed statically.
time_24hrfalseBooleanEnables the use of 24-hour time format.
weekNumbersfalseBooleanEnables the display of week numbers.
wrapfalseBoolean Custom elements and input groups
useLocaleYearfalseBooleanEnables the use of the locale-specific year format.(e.g. Buddhist Era)
resetMoveDefaulttrueBooleanOn resets the calendar, move a calendar back to the default date/time.
resetToDefaulttrueBooleanOn resets the calendar, set the default date/time to input element.