UNPKG

@carbon/react

Version:

React components for the Carbon Design System

111 lines (110 loc) 3.45 kB
/** * Copyright IBM Corp. 2016, 2025 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ import React, { type HTMLAttributes } from 'react'; type ExcludedAttributes = 'id' | 'value'; export interface TimePickerProps extends Omit<HTMLAttributes<HTMLInputElement>, ExcludedAttributes> { /** * Pass in the children that will be rendered next to the form control */ children?: React.ReactNode; /** * Specify an optional className to be applied to the container node */ className?: string; /** * Specify an optional className to be applied to the `<input>` node */ inputClassName?: string; /** * Specify an optional className to be applied to the container that wraps the `<input>` and select option */ pickerClassName?: string; /** * Specify whether the `<input>` should be disabled */ disabled?: boolean; /** * Specify whether you want the underlying label to be visually hidden */ hideLabel?: boolean; /** * Specify a custom `id` for the `<input>` */ id: string; /** * Specify whether the control is currently invalid */ invalid?: boolean; /** * Provide the text that is displayed when the control is in an invalid state */ invalidText?: React.ReactNode; /** * Specify a warning message */ warning?: boolean; /** * Provide the text that is displayed when the control is in an warning state */ warningText?: React.ReactNode; /** * Provide the text that will be read by a screen reader when visiting this * control */ labelText?: React.ReactNode; /** * The `light` prop for `TimePicker` has been deprecated. It will be removed in v12. Use the `Layer` component instead. * * @deprecated The `light` prop for `TimePicker` is no longer needed and has been deprecated. It will be removed in the next major release. Use the `Layer` component instead. */ light?: boolean; /** * Specify the maximum length of the time string in `<input>` */ maxLength?: number; /** * Optionally provide an `onBlur` handler that is called whenever the * `<input>` loses focus */ onBlur?: React.FocusEventHandler<HTMLInputElement>; /** * Optionally provide an `onChange` handler that is called whenever `<input>` * is updated */ onChange?: React.ChangeEventHandler<HTMLInputElement>; /** * Optionally provide an `onClick` handler that is called whenever the * `<input>` is clicked */ onClick?: React.MouseEventHandler<HTMLInputElement>; /** * Specify the regular expression working as the pattern of the time string in `<input>` */ pattern?: string; /** * Specify the placeholder attribute for the `<input>` */ placeholder?: string; /** * Specify whether the TimePicker should be read-only */ readOnly?: boolean; /** * Specify the size of the Time Picker. */ size?: 'sm' | 'md' | 'lg'; /** * Specify the type of the `<input>` */ type?: string; /** * Specify the value of the `<input>` */ value?: string; } declare const TimePicker: React.ForwardRefExoticComponent<TimePickerProps & React.RefAttributes<HTMLInputElement>>; export default TimePicker;