1.1.7 • Published 2 years ago

chakra-datetime-picker v1.1.7

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

chakra-datetime-picker

A Datetimepicker Component designed for Chakra-UI

Installation

npm i chakra-datetime-picker

# or

yarn add chakra-datetime-picker

Demo

Storybook

Description

This component utilize dayjs to support date and datetime input with Chakra-UI style

Props

DatePicker

PropsTypeDescription
cancelButtonPropsButtonPropsProps of the cancel button
cancelTextstringText of the cancel button
colorSchemestringColor Scheme of the DatePicker Component
currentLangKey"en" | "zh" | "zh_cn"localization key of dayjs, used to localize dayjs
defaultValuestring | number | DayjsDefault Value of the DatePicker
disableTimestampAfternumber | falseAny datetime after this value will be disabled
disableTimestampBeforenumber | falseAny datetime before this value will be disabled
formatstringformatter of dayjs
isDisabledbooleanControl is DatePicker disabled
okButtonPropsButtonPropsProps of the ok button
okTextstringText of the ok button
onCancel(day: Dayjs) => voidAction when click cancel button
onChange(formattedDay: string, day: Dayjs) => voidAction when select date
onOk(day: Dayjs) => voidAction when click Ok button
picker"anniversary" | "date"Type of the DatePicker. "anniversary" type can select month and date only. "date" type can select year, month and date
showCancelButtonbooleanDisplay control of the cancel button
showOkButtonbooleanDisplay control of the ok button
showSelectableDaysbooleanDisplay control of the Selectable days
showTimeSelectorbooleanDisplay control of the Time Selector
size"sm" | "md" | "lgSize of the DatePicker Component
selectableDays{ format: string; text: string; timestamp: number | Dayjs } []Presets of dates. Can set display format and text.
valueDayjs | nullDate Value of the Component

DatePickerInput

Includes all props of DatePicker

PropsTypeDescription
allowClearbooleanDisplay control of the clear button
datePickerDefaultIsOpenbooleanControl the DatePicker component is opened by default
datePickerIsOpenbooleanControl the DatePicker component is opened
inputPropsInputPropsProps of Chakra Input
isInvalidbooleanControl is DatePickerInput invalid
namestringName of the DatePickerInput element
onBlur() => voidAction when DatePickerInput out of focus
onClear(formattedValue: string, value: Dayjs) => voidAction when clear button is clicked
onFocus() => voidAction then DatePickerInput in focus
placeholderstringPlaceholder of DatePickerInput
refRefRef forward to DatePickerInput
wrapPortalbooleanIs DatePicker Wrapped by a Portal to document.body

v2

A major overhaul of the current DatePicker is planned. The new version will includes updated UI, performance improve, and tidy up the component props.

1.1.7

2 years ago

1.1.6

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago