No Preview

Sorry, but you either have no stories or none are selected somehow.

If the problem persists, check the browser console, or the terminal you've run Storybook from.

DateInput

An input to enter a single date value.

usage
import { DateInput } from "@sharegate/orbit-ui";
sources
Github

Usage

The Date constructor monthIndex argument is 0 based. Therefore, for 01/01/2021 you must write new Date(2021, 0, 1).

Default

A default date input.

Editable example

Value

A date input can have a value.

Editable example

Presets

A date input can offer a predefined set of frequently used dates:

Editable example

By default, presets are displayed as compact but they could also be displayed as expanded:

Editable example

Disabled

A date input can be disabled.

Editable example

Readonly

A date input can be readonly.

Editable example

Fluid

A date input can take the width of its container.

Editable example

Validation

A date input can display a validation state to communicate to the user whether the current value is valid or invalid. Implement your own validation logic in your app and pass either "valid" or "invalid" to the input via the validationState prop.

The example below illustrates how one would validate if the date is greater than 05/01/1970.

Editable example

Controlled

A date input value can be handled in controlled mode.

Editable example

API

DateInput

usage
import { DateInput } from "@sharegate/orbit-ui";
NameDescriptionDefault
autoFocus
Whether or not the input should autoFocus on render.
numberfalsetrue
-
defaultValue
The default value of value when uncontrolled.
Date
-
fluid
Whether or not the input take up the width of its container.
false | true | ResponsiveValue<boolean>
-
max
The maximum (inclusive) date.
Date
-
min
The minimum (inclusive) date.
Date
-
onDateChange
Called when the date change.
(event: ChangeEvent<HTMLInputElement>, date: Date) => void
eventReact's original synthetic event.
dateThe new date value.
-
presets
Array of pre-determined dates.
DatePreset[]
-
presetsVariant
The presets style to use.
"compact""expanded"
"compact"
validationState
Whether or not the input should display as "valid" or "invalid".
"valid""invalid"
-
value
A controlled value.
Date
-
wrapperProps
Additional props to render on the wrapper element.
Partial<OmitInternalProps<InnerBoxProps, never> & RefAttributes<any>>
-