MCPcopy
hub / github.com/marmelab/react-admin / TimeInput

Function TimeInput

packages/ra-ui-materialui/src/input/TimeInput.tsx:52–138  ·  view source on GitHub ↗
(props: TimeInputProps)

Source from the content-addressed store, hash-verified

50 * );
51 */
52export const TimeInput = (props: TimeInputProps) => {
53 const {
54 className,
55 defaultValue,
56 format = formatTime,
57 label,
58 helperText,
59 margin,
60 onBlur,
61 onChange,
62 source,
63 resource,
64 disabled,
65 readOnly,
66 parse = parseTime,
67 validate,
68 variant,
69 ...rest
70 } = useThemeProps({
71 props: props,
72 name: PREFIX,
73 });
74
75 const { field, fieldState, id, isRequired } = useInput({
76 defaultValue,
77 format,
78 parse,
79 onBlur,
80 onChange,
81 resource,
82 source,
83 validate,
84 readOnly,
85 disabled,
86 ...rest,
87 });
88
89 const { error, invalid } = fieldState;
90
91 const renderHelperText = helperText !== false || invalid;
92
93 const mergedSlotProps = {
94 // @ts-expect-error slotProps do not yet exist in MUI v5
95 ...rest.slotProps,
96 inputLabel: {
97 ...defaultInputLabelProps,
98 // @ts-expect-error slotProps do not yet exist in MUI v5
99 ...rest.slotProps?.inputLabel,
100 },
101 };
102
103 return (
104 <StyledTextField
105 id={id}
106 {...field}
107 className={clsx('ra-input', `ra-input-${source}`, className)}
108 type="time"
109 size="small"

Callers

nothing calls this directly

Calls 2

useInputFunction · 0.90
sanitizeInputRestPropsFunction · 0.90

Tested by

no test coverage detected