Date field
A day picked from a calendar or typed in words, and one way to write it everywhere.
import { DateField, Calendar, formatDay } from "@arcadia/ui"TSX
Examples
- ↓
- In the field: open the calendar, focus on its day
- ←→
- A day back or on
- ↑↓
- A week back or on
- Page UpPage Down
- A month back or on, a year with Shift
- HomeEnd
- The week's first or last day
- EnterSpace
- Pick the day
- Esc
- Close the calendar, focus back in the field
DateField
valuerequired- Day | null
- The day,
YYYY-MM-DD, or none. onChangerequired- (day: Day | null) => void
- Called with the day picked or typed (every typed day that reads, the same one too), or null when cleared.
onRefuse- (text: string) => void
- Called with a typed text it cannot read, or a day past
minormax: the field keeps its day and is marked invalid until the text changes, and the product gives the error line throughField'serror. min- Day
- The first day that can be picked or typed.
max- Day
- The last day that can be picked or typed.
today- Day
- The day it is, given by the product so a test and a server agree. Default: the machine's own day.
locale- string
- The reader's locale: the day's words, the month names it reads, the calendar's week. Default: the platform's.
size- "sm" | "md" | "lg"Default "md"
- Beside an
Inputof the same size. invalid- boolean
- Marks it invalid; a surrounding
Fieldwitherrordoes it too. clearable- boolean
false: no clear control, and an emptied text keeps the day.rootStyle- InputStyle
- Typed StyleX override for the field's frame: where it sits and
Input's--input-*knobs.
Rest props go to <input> props.
value- Day | nullDefault null
- The day picked,
YYYY-MM-DD, or none. onChange- (day: Day) => void
- Called with the day a person picks: a click, or Enter or Space on it.
min- Day
- The first day that can be picked; days before it are drawn disabled and the keys skip them.
max- Day
- The last day that can be picked.
today- Day
- The day it is, given by the product so a test and a server agree. Default: the machine's own day.
locale- string
- The reader's locale: the names of months and days, and the week's first day (its week info, Monday where the platform says nothing). Default: the platform's.
rootStyle- RootStyle
- Typed StyleX override: where the calendar sits.
Rest props go to <div> props.