Date Input
An input-style date picker that opens Calendar in a popover.
DateInput combines an input-style trigger, Popover, and Calendar. Selecting a day updates the value; the calendar stays open until you click outside it or press Escape. Set mode="range" to pick a start and end date across two months.
Contract
Section titled “Contract”Overview
Machine-readable contract from Component Spec.
Anatomy
| Part | data-refineui |
|---|---|
| root | date-input |
Variants
| Axis | Values |
|---|---|
| mode | single, range |
States
| Scope | Category | Values |
|---|---|---|
| component | pseudo | focus-visible |
| component | component | selection: placeholder, value |
| component | component | validation: error, success |
| component | availability | disabled |
| component | environment | dir |
Accessibility
| Slot | Element | Native | Labeling |
|---|---|---|---|
| date-input | button | true | accessibleName: required |
Keyboard
| Key | Action | Native |
|---|---|---|
| Enter | activate | true |
| Space | activate | true |
Focus
| Section | Property | Value |
|---|---|---|
| visual | required | true |
| visual | selector | :focus-visible |
Layout
| Property | Value |
|---|---|
| direction | logical |
| rtl | true |
Tokens
Section titled “Tokens”Variant
Select a recipe variant — preview and Recipe → Tokens update together.
Recipe → Tokens
Slot bindings for mode="single" — declared in DateInput/style → Input tokens.
| Slot | Variant | Property | Trace | Semantic | Light → foundation | Dark → foundation | Recipe class |
|---|---|---|---|---|---|---|---|
| root | — | text | input.text | foregroundPrimary | primaryBlack | neutralWhite | text-refineui-alias-foreground-primary placeholder:text-refineui-alias-foreground-placeholder |
| root | — | placeholder | input.placeholder | foregroundPlaceholder | neutral450 | neutral500 | placeholder:text-refineui-alias-foreground-placeholder |
| root | — | background | input.background | backgroundPrimary | neutralWhite | neutral900 | bg-refineui-alias-background-primary |
| root | — | disabledBackground | input.disabledBackground | backgroundSurfaceDisabled | neutral150 | neutral850 | bg-refineui-alias-background-surface-disabled |
| root | — | border.default | input.border.default | borderDefault | neutral300 | neutral650 | border-refineui-thin border-refineui-alias-border-default |
| root | — | border.focus | input.border.focus | borderFocus | neutral750 | neutral350 | border-refineui-thin border-refineui-alias-border-strong |
| root | — | border.error | input.border.error | borderError | red500 | red500 | border-refineui-thin border-refineui-alias-border-error |
| root | — | border.success | input.border.success | borderSuccess | green500 | green500 | border-refineui-thin border-refineui-alias-border-success |
| root | — | border.disabled | input.border.disabled | borderDisabled | neutral250 | neutral700 | border-refineui-thin border-refineui-alias-border-disabled |
Component token trace
All paths in token-trace-v2.json prefixed with input.
| Trace | Semantic | Light foundation | Dark foundation | Light | Dark |
|---|---|---|---|---|---|
| input.background | backgroundPrimary | neutralWhite | neutral900 | #FFFFFF | #1A1A1A |
| input.border.default | borderDefault | neutral300 | neutral650 | #DBDBDB | #5B5B5B |
| input.border.disabled | borderDisabled | neutral250 | neutral700 | #E0E0E0 | #404040 |
| input.border.error | borderError | red500 | red500 | #FF6969 | #FF6969 |
| input.border.focus | borderFocus | neutral750 | neutral350 | #333333 | #D8D8D8 |
| input.border.success | borderSuccess | green500 | green500 | #26B12D | #26B12D |
| input.disabledBackground | backgroundSurfaceDisabled | neutral150 | neutral850 | #F0F0F0 | #222222 |
| input.placeholder | foregroundPlaceholder | neutral450 | neutral500 | #BBBBBB | #A4A4A4 |
| input.text | foregroundPrimary | primaryBlack | neutralWhite | #212121 | #FFFFFF |
Installation
Section titled “Installation”npm install @refineui/react @refineui/tokens yarn add @refineui/react @refineui/tokens pnpm add @refineui/react @refineui/tokens bun add @refineui/react @refineui/tokens import { useState } from "react";import { DateInput } from "@refineui/react"; const [date, setDate] = useState<Date>(); <DateInput value={date} onValueChange={setDate} placeholder="Choose a delivery date" locale="en-US" weekStartsOn={1} fullWidth/>; Use defaultValue for an uncontrolled field. size="xs" | "sm" | "md" | "lg" | "xl" uses the same control heights, padding, and typography as Input; it also inherits a surrounding Field size. Pass error, success, and disabled just as you would for an Input.
API Reference
Section titled “API Reference”| Prop | Default | Type | Description |
|---|---|---|---|
| mode | "single" | "single" | "range" | Single date or a start/end range across two months. |
| value | — | Date | Controlled selected date. |
| defaultValue | — | Date | Initial value for uncontrolled use. |
| onValueChange | — | (value: Date) => void | Called after a day is selected. |
| rangeStart / rangeEnd | — | Date | Controlled range (range mode). |
| defaultRangeStart / defaultRangeEnd | — | Date | Initial range for uncontrolled range mode. |
| onRangeChange | — | (start?: Date, end?: Date) => void | Called when the range changes; end is undefined until the second day is picked. |
| placeholder | "Select date" / "Select date range" | string | Text shown before selection. |
| locale | browser locale | string | Locale used to format the selected date. |
| weekStartsOn | 0 | 0 | 1 | First calendar weekday: Sunday or Monday. |
| size | "lg" | "xs" | "sm" | "md" | "lg" | "xl" | Matches Input control sizing. |
| fullWidth | false | boolean | Makes the trigger fill its container. |
| error / success / disabled | false | boolean | Input state styling and availability. |