Ravox KitForms

Date Picker

A date field that accepts both: typing the date (slashes are added automatically, in the language's order: dd/mm/yyyy in Brazil) or picking from the calendar that opens on top. DateRangePicker takes a range with two fields, two months and shortcuts such as "Last 7 days". Warns about a date that doesn't exist, is out of bounds or unavailable.

Digite só os números: as barras entram sozinhas.

Settings

Tipo
Tamanho
Toggles

Examples

Birth date: typing is faster

Mais rápido digitando: 14031992.

Range with shortcuts

Vendas no período

Delivery: limits and custom shortcuts

Não entregamos aos domingos.

With a form error

Informe quando o contrato começa.

Installation

The command creates components/ui/date-picker.tsx in your project and installs the theme with it. The file is yours: edit it as you like.

npx @ravox-ui/cli add date-picker

Props

PropTypeDefaultDescription
value / defaultValueDate | null · { from?, to? }—DatePicker uses a date; DateRangePicker, a range.
onValueChange(date: Date | undefined) => void · (range) => void—Called when picking from the calendar, a shortcut, or when the typed date becomes complete and valid. A cleared field sends undefined.
presets{ label, date(today) }[] · { label, range(today) }[]—Buttons beside the calendar. Ready-made: datePresets and rangePresets (in English) or datePresetsFor(locale) and rangePresetsFor(locale), which follow the language (en or pt).
min · max · isDateDisabledDate · Date · (date: Date) => boolean—Limits that apply in the calendar and to what is typed (with the right message).
label · hint · errorReactNode—Label, help and error. Without an outside error, the field itself warns about an incomplete, nonexistent or out-of-bounds date.
size"sm" | "md" | "lg""md"Height: 32, 40 or 48px.
weekStartsOn0 a 6o do localeDay the week starts on in the calendar. Without the prop, it comes from Intl.
localestringidioma do navegadorLanguage of the calendar, the typed field order (dd/mm/yyyy in pt-BR, mm/dd/yyyy in en-US, yyyy-mm-dd in ja…) and the texts (built in for en and pt; other languages use en). On the server it renders in en-US and switches after hydration.
onBlur() => void—Focus left the field and the calendar (the Controller's onBlur).
name · namesstring · [string, string]—Sends the date in ISO (yyyy-mm-dd) in <input type="hidden">. In a range, one name for each end.
fieldLabels[string, string]["Start date", "End date"]DateRangePicker: what the screen reader reads for each field (default translated: en or pt, depending on locale).
wrapperClassName · panelClassNamestring—Classes of the outer block and of the floating panel. className goes on the field box.

More in Forms