Input
Date Input
NewA typed date field with a mask that adds its own separators and a month calendar that slides between months.
npx motionsnack add date-inputCustomize
<DateInput />Props
30 properties
| Property | Type | Default | Description |
|---|---|---|---|
| value | string | - | Controlled date as ISO yyyy-mm-dd. Leave undefined to let the component manage it. |
| defaultValue | string | '' | Date on first render when uncontrolled, ISO yyyy-mm-dd. |
| onChange | (value: string) => void | - | Called with the ISO date, or an empty string while the date is incomplete or invalid. |
| name | string | - | Name of a hidden input that submits the ISO date with a form. |
| errorColor | string | undefined | Error colour for both themes. Undefined uses the per-theme pair (#dc2626 light, #ef4444 dark). |
| isDateDisabled | (iso: string) => boolean | - | Days that cannot be picked, besides min / max. |
| open | boolean | - | Controlled open state of the calendar. |
| defaultOpen | boolean | false | Open state of the calendar on first render when uncontrolled. |
| onOpenChange | (open: boolean) => void | - | Called on every user-caused open or close of the calendar. |
| chooseDateLabel | string | 'Choose date' | Name of the calendar button while no date is set. |
| changeDateLabel | string | 'Change date, {date}' | Name of the calendar button once a date is set. |
| previousMonthLabel | string | 'Previous month' | Name of the previous month button. |
| nextMonthLabel | string | 'Next month' | Name of the next month button. |
| id | string | generated | Id of the input. |
| className | string | '' | Extra classes on the wrapper. |
| label | string | 'Start date' | Label above the field. Empty hides it. |
| format | 'dd.mm.yyyy' | 'mm/dd/yyyy' | 'yyyy-mm-dd' | 'dd.mm.yyyy' | Order of the typed date. Separators insert themselves while typing. |
| showCalendar | boolean | true | Show the calendar button and its month view. |
| weekStartsOn | '1' | '0' | '1' | First day of the week in the calendar. |
| locale | string | 'en-US' | Locale of the month and weekday names, e.g. en-US or cs-CZ. |
| min | string | '' | Earliest date allowed, ISO yyyy-mm-dd. Empty means no limit. |
| max | string | '' | Latest date allowed, ISO yyyy-mm-dd. Empty means no limit. |
| helperText | string | 'Pick a weekday, we start projects Monday to Friday.' | Small text under the field. Empty hides it. |
| invalidText | string | 'That date does not exist.' | Message for a full date that does not exist, e.g. 31.02. |
| rangeText | string | 'Pick a date between {min} and {max}.' | Message for a date outside min / max. {min} and {max} are replaced. |
| error | string | '' | Error message from outside. Any text switches the field to its error state. |
| required | boolean | false | Marks the field as required. |
| disabled | boolean | false | Disables the field. |
| height | number | 48 | Height of the field (48, or 40 compact). |
| radius | number | 12 | Corner radius of the field. |
About Date Input
Date Input lets visitors type a date as fast as they can or pick one from a calendar. The mask follows the format you choose (day.month.year, month/day/year or year-month-day) and adds the separators itself, while Backspace removes them without getting stuck. A date that does not exist, like the 31st of February, or one outside the minimum and maximum shows a clear message. The calendar button opens a month view with the weekday names in your locale, today marked with a dot and the picked day filled in black and white. Months slide sideways as you move between them, and the grid works with the arrow keys, Page Up and Down, Home, End and Enter. onChange returns an ISO date.
What's included
- Self-inserting separators in three formats
- Month calendar with a sliding grid
- Monday or Sunday week start, names from any locale
- Min and max dates with disabled days
- Invalid and out-of-range messages
- Full keyboard navigation
- Light and dark look
- Type
- Animated React input component
- Library
- Components · Input
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-11-23
- Install
npx motionsnack add date-input