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.
An input to enter a single date value.
import { DateInput } from "@sharegate/orbit-ui";
The Date constructor monthIndex
argument is 0 based. Therefore, for 01/01/2021
you must write new Date(2021, 0, 1)
.
A default date input.
A date input can have a value.
A date input can offer a predefined set of frequently used dates:
By default, presets are displayed as compact but they could also be displayed as expanded:
A date input can be disabled.
A date input can be readonly.
A date input can take the width of its container.
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.
A date input value
can be handled in controlled mode.
import { DateInput } from "@sharegate/orbit-ui";
Name | Description | Default | ||||
---|---|---|---|---|---|---|
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
| - | ||||
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>> | - |