JGuang

TimePicker

TimePicker · Arco Design

Preview
npm install @arco-design/web-react@2.66.18

TimePicker

Select the time on the popup panel to conveniently complete the time input control.

Install

npm install @arco-design/web-react@2.66.18

Import @arco-design/web-react/dist/css/arco.css at the entry and set the locale with ConfigProvider. React 19 projects must also import @arco-design/web-react/es/_util/react-19-adapter first, or imperative APIs such as Message and Modal cannot render.

Examples

  • Basic: The basic usage of TimePicker.
  • Status: different status
  • Under Control: value and onChange need to be used together.
  • Prefix: Set the prefix via the prefix property
  • Size: There are four sizes.
  • Disabled: Disabled.
  • Custom format: By setting format, you can customize the hour, minute, and second.
  • Step: By setting step, you can customize the step length of the hour, minute, and second.
  • defaultValue: TimePicker has a default value.
  • Extra content: Show extra content.
  • Disable partial time option: By setting disabledHours disabledMinutes disabledSeconds, you can disable some options of hour/minute/second.
  • 12 hours: By setting use12Hours, you can customize the hours, minutes, and seconds.
  • RangePicker: Select time range.
  • disableConfirm: Skip the confirm step and click directly to select time.
  • UTC: Use utcOffset to set the UTC time. Note: When using UTC or time zonetime, use timestamp or Date object when passing value. Strings cannot represent unique time, which will cause trouble.
  • Timezone: Use timezone to set timezone, if set the utcOffset, utcOffset takes effect. Note: When using UTC or time zonetime, use timestamp or Date object when passing value. Strings cannot represent unique time, which will cause trouble.

Examples come from the official Arco Design repository (MIT) at the commit published as npm 2.66.18. Some use online images or upload endpoints; network requests are disabled in previews.

API

Picker

Common properties of TimePicker and RangePicker

PropertyDescriptionTypeDefaultValueVersion
allowClearWhether to show clear buttonbooleantrue-
disableConfirmDisable the confirm step, click to select time directly without click the confirm button.boolean-2.12.0
disabledWhether to disableboolean--
editableWhether input box can be enteredbooleantrue-
errorWhether the textarea is error.(Deprecated, removed in the next major version, use status='error' instead)boolean--
hideDisabledOptionsHide the disabled optionsboolean--
popupVisibleWhether the popup is visible or notboolean--
scrollStickyThe time column is automatically adsorbed and selected when scrollingbooleantrue2.23.0
unmountOnExitWhether to destroy popup when hiddenboolean--
use12HoursDisplay as 12 hours format, with default format h:mm:ss aboolean--
utcOffsetSet the timezone offset, set to 0 if utc time is required.number--
formatDate format, refer to dayjsstringHH:mm:ss-
timezonetimezone name, if utcOffset is set, utcOffset takes effect.string--
positionThe position of the popup box'top' | 'tl' | 'tr' | 'bottom' | 'bl' | 'br'bl-
sizeInput box size'mini' | 'small' | 'default' | 'large'--
statusStatus'error' | 'warning'-2.45.0
extraAdditional content at the bottomReactNode--
prefixprefixReactNode-2.43.0
triggerElementTrigger element.ReactNode-2.38.0
classNameAdditional css classstring | string[]--
iconsUsed to configure icons{ inputSuffix?: ReactNode }--
placeholderThe placeholder of input boxstring | string[]--
stepSet the hour/minute/second selection interval.{ hour?: number; minute?: number; second?: number }--
styleAdditional styleCSSProperties--
triggerPropsThe props of the Trigger componentPartial<TriggerProps>--
disabledHoursTo specify the hours that cannot be selected() => number[]--
disabledMinutesTo specify the minutes that cannot be selected(selectedHour) => number[]--
disabledSecondsTo specify the seconds that cannot be selected(selectedHour, selectedMinute) => number[]--
getPopupContainerThe parent node of the popup(node: HTMLElement) => Element--
onClearCallback when click the clear button() => void--

TimePicker

PropertyDescriptionTypeDefaultValueVersion
showNowBtnWhether to show the button to select current timebooleantrue2.21.0
defaultValueTo set default timeCalendarValue--
valueTo set timeCalendarValue--
onChangeCallback when selected value changes(valueString: string, value: Dayjs) => void--
onSelectCallback when select time(valueString: string, value: Dayjs) => void--

TimePicker.RangePicker

PropertyDescriptionTypeDefaultValueVersion
orderWhether the start and end times are automatically sortedbooleantrue2.21.0
defaultValueTo set default timeCalendarValue[]--
placeholderThe placeholder of input boxstring[]--
valueTo set timeCalendarValue[]--
onChangeCallback when the selected value changes(valueString: string[], value: Dayjs[]) => void--
onSelectCallback when select time(valueString: string[], value: Dayjs[]) => void--

CalendarValue

export type CalendarValue = Dayjs | Date | string | number;