- Notifications
You must be signed in to change notification settings - Fork6
Blazor version of FlatPicker.js
License
NotificationsYou must be signed in to change notification settings
mathisloge/FlatpickrBlazor
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
useshttps://github.com/flatpickr/flatpickr under the hood.
For a ready to use example, visithttps://github.com/mathisloge/FlatpickrBlazorExample
Nuget Version is availible underhttps://www.nuget.org/packages/FlatPickrBlazor
Install-Package FlatPickrBlazor<div><Flatpickr hidden @ref="_datepicker" Options="@calendarOpts" OnChange="@OnChangeDate" /><Flatpickr Options="@monthPickerOpts" PluginOptions="@monthPluginOptions" /></div>@code{ private Flatpickr _datepicker; private FlatpickrOptions calendarOpts = new FlatpickrOptions { Inline = true, WeekNumbers = true, MaxDate = DateTimeOffset.UtcNow, Locale = "de", Mode = FlatpickrOptionsMode.Range }; private FlatpickrOptions monthPickerOpts = new FlatpickrOptions { Inline = true }; // these are already default values, so new FlatpickrPluginOptions() would fullfill everything, if you want default values private FlatpickrPluginOptions monthPluginOptions = new FlatpickrPluginOptions { UseMonthSelectPlugin = new FlatpickrPluginOptions.MonthSelectOptions { ShortHand = false, DateFormat = "F Y", AltFormat = "F Y", Theme = "light" } }; private void OnChangeDate(List<DateTimeOffset> dateTimes) { foreach (var dateTime in dateTimes) { Console.WriteLine(dateTime.ToString()); } }}you have to include at a minimum these to your _Host.cshtml
<link href="_content/FlatpickrBlazor/flatpickr.min.css" rel="stylesheet" /><script src="_content/FlatpickrBlazor/flatpickr.min.js"></script><script src="_content/FlatpickrBlazor/flatpickr.blazor.js"></script>to add a locale (specify in your FlatpickrOptions variable) add the following script:
<script src="_content/FlatpickrBlazor/l10n/de.js"></script>and change the "de.js" with your choosed language
to add the plugins, you have to include the script and style files. e.g. for the month select plugin:
<link href="_content/FlatpickrBlazor/plugins/monthSelect/style.css" rel="stylesheet" /><script src="_content/FlatpickrBlazor/plugins/monthSelect/index.js"></script>About
Blazor version of FlatPicker.js
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.