Skip to content
Playground

Date Input

A standalone text field for parsing and formatting dates.

A standalone text field for parsing and formatting dates.

TSX
import { DateInput } from "@zentara-co/zenos-ui";

DateInput uses the shared Zenos sm, md, and lg control scale from Input.

Surfaces match Input: default (standard), filled (subtle), and none (borderless).

Empty, filled, invalid, and disabled treatments are inherited from Input. Invalid matches Input. Compose with Field for labels, descriptions, and errors. DateInput also sets invalid when typed text fails parsing on blur.

Valid text updates the date immediately. Invalid text remains editable and becomes invalid on blur, while clearing the control emits undefined.

Use YYYY-MM-DD.

Value: 2026-09-24

Provide format and parse together when a product uses a different typed-date convention.

Displayed and parsed as DD/MM/YYYY.

Variants

defaultfillednone

Sizes

smmdlg

API

PropTypeDefaultDescription
value Date | undefined — Controlled parsed date.
defaultValue Date | undefined — Initial uncontrolled date.
onValueChange (date: Date | undefined) => void — Runs after valid parsing or clearing.
variant default | filled | none default Surface treatment inherited from Input (`default` = standard, `filled` = subtle, `none` = borderless).
size sm | md | lg md Control height inherited from Input.
format (date: Date) => string — Custom date formatter.
parse (text: string) => Date | undefined — Custom date parser.
invalid boolean — Controls the invalid presentation.
onInvalidChange (invalid: boolean) => void — Runs when validity changes, including validation on blur.
onChange ChangeEventHandler<HTMLInputElement> — Runs for every text edit before parsing completes.
native props React.InputHTMLAttributes<HTMLInputElement> — Forwards native attributes, events, aria-*, data-*, className, style, and ref.

Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props, including className, style, aria-*, and data-*.

DateInput remains a native text input with numeric input mode. Give it a visible Field label or another accessible name, provide format instructions in Field.Description, and connect validation feedback through Field.Error. The component preserves native required, disabled, name, autocomplete, and focus behavior.