navius

Date Input

A segmented date editor: culture-ordered spinbutton fields for day, month and year, edited entirely from the keyboard, with no popup calendar.

Value: 2026-07-04

Features

  • Each unit is an APG role="spinbutton" segment; segment order and separators follow the culture's short-date pattern (Culture).
  • Arrows step (and wrap), digits type and auto-advance to the next segment, Backspace clears; all value logic runs in C#, no popup.
  • Owns a DateOnly?. Controlled via @bind-Value, uncontrolled via DefaultValue.
  • Granularity trims to day / month / year; MinValue / MaxValue surface as data-invalid without snapping the value.
  • Field-aware: adopts a NaviusField's control id and reports filled / dirty / touched / valid. A hidden input submits ISO yyyy-MM-dd under Name.

Installation

Install the brain, or copy just this primitive in with the CLI.

Anatomy

A single element. The segments are rendered internally from the culture and granularity.

API Reference

The segmented date field. Renders a div with role=group holding the auto-generated segments and a hidden bubble input. Value is two-way bindable.

Prop Type Default
Value DateOnly? -
ValueChanged EventCallback<DateOnly?> -
DefaultValue DateOnly? -
Granularity string "day"
MinValue DateOnly? -
MaxValue DateOnly? -
PlaceholderValue DateOnly? today
Disabled bool false
ReadOnly bool false
Required bool false
Invalid bool false
ForceLeadingZeros bool false
Culture CultureInfo? current
Dir string? -
Name string? -
ChildContent RenderFragment? -
…attributes IDictionary<string, object>? -
Data attribute Values
[data-navius-date-input] Present on the group
[data-disabled] Present when disabled
[data-readonly] Present when read-only
[data-invalid] Present when invalid or out of range
[data-filled] Present when any segment holds a value
[data-dirty] Present after the first edit
[data-focused] Present while a segment has focus
[data-touched] Present after focus has left the group

Each editable segment renders a <span role="spinbutton"> carrying data-navius-date-input-segment, data-segment ("year" | "month" | "day") and data-placeholder while empty; the separators carry data-segment="literal". Style off these hooks.

Accessibility

Each segment is an APG spinbutton with aria-valuenow / aria-valuemin / aria-valuemax / aria-valuetext; the group carries aria-invalid and, under a Field, aria-describedby. Left / Right navigation mirrors under rtl.

Key Description
Arrow Up / Arrow Down Steps the focused segment by one (wrapping at the segment's min/max).
Page Up / Page Down Steps by a larger amount (5 years, 3 months, 7 days).
Home / End Jumps the focused segment to its minimum / maximum.
0-9 Types into the focused segment and auto-advances once it can hold no more digits.
Backspace / Delete Clears the focused segment.
Arrow Left / Arrow Right Moves between segments (mirrored under rtl).