Date Input

Forms

A text input field specifically formatted for date entry. Supports various date formats and validation.

Import

import { DateInput } from "@/components/ui/date-input";

Usage

Basic Date Input

Type a date in the specified format

Custom Format

Use different date format patterns

With Error

Display validation errors

Please enter a valid date

Disabled

Disabled state

API Reference

valueundefined
Date

Controlled value of the input

defaultValueundefined
Date

Default date value for uncontrolled usage

onValueChangeundefined
(date: Date | undefined) => void

Callback when date value changes

labelundefined
string

Label text displayed above the input

dateFormat"MM/dd/yyyy"
string

Date format string (date-fns format)

placeholder"MM/DD/YYYY"
string

Placeholder text

errorundefined
string

Error message to display

disabledfalse
boolean

Whether the input is disabled