Import
Usage
Props
Callback with valid Date object when all three fields (day, month, year) are complete and valid. Only fires when the full date is valid according to moment.js validation.
Default value in
"YYYY-MM-DD" format (e.g., "1990-05-15").Error message displayed below the inputs in red text with fade-in animation. Component also displays built-in validation error “Fecha no válida” for invalid dates.
Custom CSS properties applied to each input container.
Custom CSS properties for the input elements.
Disables all three input fields.
Inherits all standard HTML input attributes from
InputProps (excluding onChange which is overridden).Behavior
- Auto-focus: Automatically focuses next field when 2 digits are entered (day → month → year)
- Backspace navigation: Focuses previous field when backspace is pressed on empty field
- Numeric-only: Only accepts numeric input with
inputMode="numeric"andpattern="[0-9]*" - Validation: Uses moment.js to validate the complete date (e.g., catches invalid dates like Feb 30)
- Spanish locale: Error messages displayed in Spanish
Examples
Basic Usage
With Default Value
With Error Handling
Field Configuration
- Day field: 2-digit max, placeholder “Día”
- Month field: 2-digit max, placeholder “Mes”
- Year field: 4-digit max, placeholder “Año”
Input component with default design.