You are viewing a PR preview for PR #1506

Agriculture Design System
Beta
Design System for the Export Service

Date picker

The Date picker component allows users to select a single date via a calendar or text input.

View in FigmaView in StorybookView in Github
import { ... } from '@ag.ds-next/react/date-picker';

Usage

Date picker components can be imported via the date-picker entrypoint in the @ag.ds-next/react package.

For example:

import { ... } from '@ag.ds-next/react/date-picker';

Props

DatePicker Props
PropTypeDescription
labelstringDescribes the purpose of the field.
onChange(day: Date | undefined) => voidFunction to be fired following a change event.
valuestring | Date | undefinedThe value of the field.
autoComplete?string
autoFocus?boolean
block?booleanIf true, the field will stretch to the fill the width of its container.
disabled?boolean
hideOptionalLabel?booleanIf true, "(optional)" will never be appended to the label.
hint?stringProvides extra information about the field.
id?string
initialMonth?DateThe calendar month to initially show if no value is set.
inputRef?Ref<HTMLInputElement>Ref to the input element.
invalid?booleanDefault: "false"If true, the invalid state will be rendered.
maxDate?DateIf set, any days after this date will not be selectable.
maxWidth?"md" | "lg" | "xl"Default: "md"The maximum width of the field.
message?stringMessage to show when the field is invalid.
minDate?DateIf set, any days before this date will not be selectable.
name?string
onBlur?FocusEventHandler<HTMLInputElement>
onFocus?FocusEventHandler<HTMLInputElement>
onInputChange?((inputValue: string) => void)Function to be fired when the input value is updated.
required?booleanIf false, "(optional)" will be appended to the label.
yearRange?{ from: number; to: number; }The range of options to display in calendar year select.

Source

You can view the full source code for this package on Github.