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.

DateRangeInput

An specialized input to enter a range of dates.

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

Usage

Default

A default date range input.

Editable example

Value

A date range input can have values.

Editable example

Presets

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

Editable example

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

Editable example

Disabled

A date range input can be disabled.

Editable example

Readonly

A date range input can be readonly.

Editable example

Fluid

A date range input can take the width of its container.

Editable example

Validation

A date range 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 between 05/01/1970 and 05/01/2021.

Editable example

Form

A date range input can be used in a form by providing a name prop. When doing so, the name attribute of each inputs will be prefixed by the specified name prop and will respectively be suffixed by "-start-date" and "-end-date".

For example, if the provided name prop is "filter" the start date input name attribute will be "filter-start-date" and the end date input name attribute will be "filter-end-date".

Editable example

Controlled

A date range input startDate and endDate can be handled in controlled mode.

Editable example

API

DateRangeInput

usage
import { DateRangeInput } from "@sharegate/orbit-ui";
NameDescriptionDefault
autoFocus
Whether or not the input should autoFocus on render.
numberfalsetrue
-
defaultEndDate
The initial value of end date.
Date
-
defaultStartDate
The initial value of start date.
Date
-
disabled
Whether or not the input is disabled.
falsetrue
-
endDate
A controlled end date value.
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
-
onDatesChange
Called when the date(s) are / is applied.
(event: SyntheticEvent<Element, Event>, startDate: Date, endDate: Date) => void
eventReact's original event.
startDateSelected start date.
endDateSelected end date.
-
placeholder
Temporary text that occupies both date inputs when they are empty.
string
"dd/mm/yyyy"
presets
Array of pre-determined dates range.
DateRangePreset[]
-
presetsVariant
The presets style to use.
"compact""expanded"
-
readOnly
Whether or not the input is readonly.
falsetrue
-
required
Whether or not a user input is required before form submission.
falsetrue
-
startDate
A controlled start date value.
Date
-
validationState
Whether or not the input should display as "valid" or "invalid".
"valid""invalid"
-