Appica UIUI 1.0.0

Date Field

A segmented input for typing a date.

MMDDYYYY

Usage

DateField is a keyboard-first date entry: the format string is split into editable day/month/year segments, each a spinbutton. Type a number, paste, or press ↑/↓ to step a segment; focus advances automatically. The value is a native Date (or null while empty). It's not based on Base UI — it's a custom component sharing the Input styling.

Examples

Variants

Sizes

Formats

The format string (date-fns tokens) decides which segments show and how — numeric (MM), abbreviated (MMM), or full (MMMM) months, 2- or 4-digit years, and any literal separators.

Controlled

Drive the value with value + onValueChange. The callback fires with a Date once every segment is filled, or null when the field is cleared.

With an icon

Use startSlot / endSlot to render adornments inside the field frame.

Disabled, read-only & error states

disabled greys out the field and blocks interaction; readOnly keeps it focusable and readable but prevents edits. Set aria-invalid to paint the error state — it's mirrored to data-invalid. The field also inherits disabled and the error state from a surrounding Field, so wrapping it in a Field marked invalid produces the same styling and is the better choice when you're also rendering a validation message.

RTL

Every Appica UI component supports right-to-left layouts out of the box. Set the dir attribute on a container (commonly your <html> element) so CSS logical properties resolve correctly, and wrap your tree in DirectionProvider so direction-aware behavior — roving focus, popup placement, and the like — follows the same direction.

For setup details and caveats, see the RTL guide.

تاريخ الميلاد
06232026

API reference

Renders a <div role="group"> and forwards the remaining <div> props (id, aria-*, ref, …). The error styling is driven by the data-invalid attribute; setting aria-invalid marks the field invalid — it sets data-invalid for styling and conveys the state to assistive technology.

Accessibility

  • The field is a role="group"; each segment is a role="spinbutton" with aria-label (day/month/year) and aria-valuenow/aria-valuetext.
  • ←/→ move between segments, ↑/↓ step the focused segment, Home/End jump to the first/last, Backspace/Delete clear; typing fills and auto-advances.
  • disabled removes the segments from the tab order; readOnly keeps them focusable but inert.
  • Segment focus styling uses a transition wrapped in motion-reduce:, so it's skipped under reduced motion.

© 2026 Appica UI. A free component library, crafted by the Appica team.