Bind a DatePicker to your C# model in BookingPage.html.
dotnet add package RecursiveAI.OneApp.KitRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
<DatePicker Model="{Booking}" AriaLabel="Booking date" />
In BookingPage.cs, declare public CalendarModel Booking { get; } = new();.
The example is the full program below: unzip it and dotnet run.
The button opens a month grid and shows the selected date when you pick a day.
Full program
The zip includes Demo.csproj, a .NET 10 console project. If starting from a new console project, also add the app host and the template compiler:
dotnet add package RecursiveAI.OneApp dotnet add package RecursiveAI.OneUI
To assemble the example by hand, put these three files beside the project file. The OneUI package compiles BookingPage.html into the other half of the BookingPage partial class.
BookingPage.html wraps the picker in the kit’s Theme and formats the selected date as year-month-day:
<Theme> <main style="padding: 24px"> <h1>Booking</h1> <DatePicker Model="{Booking}" AriaLabel="Booking date" TriggerId="booking" Placeholder="Pick a date" Format="yyyy-MM-dd" /> </main> </Theme>
BookingPage.cs keeps the selection in C# and sets a fixed “today” so the example always opens to December 2026:
using System.Globalization; using OneApp.Kit; public partial class BookingPage { public CalendarModel Booking { get; } = new() { Today = new DateOnly(2026, 12, 5), Culture = CultureInfo.GetCultureInfo("en-US"), }; protected override void OnMounted() { Booking.ValueChanged += date => Console.WriteLine($"Booking date: {date:yyyy-MM-dd}"); } }
Program.cs opens the window:
using OneApp; using var host = AppHost.Create(new AppOptions(new BookingPage()) { Title = "Booking", Width = 420, Height = 440, }); host.Run();
Click Pick a date, then 8 in December 2026. The steps are the same on Windows and macOS (Apple silicon), but the output below was verified only on Linux. The calendar closes, the button reads 2026-12-08, and the terminal prints:
Booking date: 2026-12-08If the compiler can’t find Booking, make sure the template and partial class are both called BookingPage and the project references RecursiveAI.OneUI.

Variations
To show the calendar directly on the page instead of behind a button, replace the DatePicker with:
<Calendar Model="{Booking}" Bordered="true" />Related recipes
The short answer
In a OneApp desktop or mobile project, add the kit’s DatePicker to a OneUI template and pass in a C# CalendarModel. Read Booking.Value for the current selection or subscribe to Booking.ValueChanged to act when it changes. The type is DateOnly?: null means no day is selected. A booking day doesn’t need a time of day or a time zone; add those separately if you’re scheduling a specific appointment time. The same component goes in a mobile project; the zip runs as a desktop app, and the mobile guide covers deploying to a phone.
How do I set the minimum and maximum dates in a C# date picker?
Set Min and Max on the model, not on the picker. Add these lines to the initializer in BookingPage.cs to allow bookings from December 7 through December 11, inclusive:
Min = new DateOnly(2026, 12, 7), Max = new DateOnly(2026, 12, 11),
Days outside that interval are dimmed and can’t be chosen, even though you can still reach them with the arrow keys. The previous and next month buttons are disabled when the month they would open has no available dates. To rule out dates inside the interval as well, such as a holiday, use the model’s Disabled predicate. These rules control what the user can choose; they don’t replace checking availability again before saving a booking.
How do I select a date with the keyboard?
Tab to the picker button and press Enter or Space to open it. The calendar focuses the chosen day, or today if there’s no selection. Use Left and Right to move a day, Up and Down to move a week, and Page Up and Page Down to switch months. Enter or Space picks the focused day. In single-date mode, picking a day closes the calendar and returns focus to the button. Escape also closes it, without changing the selection.
Use AriaLabel to name the button by purpose, such as “Booking date.” The label stays useful both before and after the visible button text changes. The date picker docs describe the grid’s accessibility roles, range selection, and how the model’s culture sets month names and the first day of the week.