Skip to content

Commit 21b7646

Browse files
committed
[TextField] Fix slot errors
1 parent aefcbc6 commit 21b7646

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

packages/mui-joy/src/TextField/TextField.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const TextField = React.forwardRef(function TextField(inProps, ref) {
6666
children,
6767
className,
6868
component,
69-
components = {},
69+
slots = {},
7070
slotProps = {},
7171
label,
7272
helperText,
@@ -118,11 +118,11 @@ const TextField = React.forwardRef(function TextField(inProps, ref) {
118118
ref,
119119
className: clsx(classes.root, className),
120120
elementType: TextFieldRoot,
121-
externalForwardedProps: { ...other, component },
121+
externalForwardedProps: { ...other, component, slots, slotProps },
122122
ownerState,
123123
});
124124

125-
const Input = components.Input || JoyInput;
125+
const Input = slots.input || JoyInput;
126126

127127
return (
128128
<SlotRoot {...rootProps}>
@@ -132,8 +132,8 @@ const TextField = React.forwardRef(function TextField(inProps, ref) {
132132
id={formLabelId}
133133
required={required}
134134
{...slotProps.label}
135-
{...(components.Label && {
136-
component: components.Label,
135+
{...(slots.label && {
136+
component: slots.label,
137137
})}
138138
>
139139
{label}
@@ -168,8 +168,8 @@ const TextField = React.forwardRef(function TextField(inProps, ref) {
168168
<FormHelperText
169169
id={helperTextId}
170170
{...slotProps.helperText}
171-
{...(components.HelperText && {
172-
component: components.HelperText,
171+
{...(slots.helperText && {
172+
component: slots.helperText,
173173
})}
174174
>
175175
{helperText}
@@ -213,15 +213,6 @@ TextField.propTypes /* remove-proptypes */ = {
213213
* Either a string to use a HTML element or a component.
214214
*/
215215
component: PropTypes.elementType,
216-
/**
217-
* @ignore
218-
*/
219-
components: PropTypes.shape({
220-
HelperText: PropTypes.elementType,
221-
Input: PropTypes.elementType,
222-
Label: PropTypes.elementType,
223-
Root: PropTypes.elementType,
224-
}),
225216
/**
226217
* @ignore
227218
*/
@@ -302,6 +293,15 @@ TextField.propTypes /* remove-proptypes */ = {
302293
label: PropTypes.object,
303294
root: PropTypes.object,
304295
}),
296+
/**
297+
* @ignore
298+
*/
299+
slots: PropTypes.shape({
300+
helperText: PropTypes.elementType,
301+
input: PropTypes.elementType,
302+
label: PropTypes.elementType,
303+
root: PropTypes.elementType,
304+
}),
305305
/**
306306
* Leading adornment for this input.
307307
*/

packages/mui-joy/src/TextField/TextFieldProps.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ type InputRootKeys =
3030
export interface TextFieldTypeMap<P = {}, D extends React.ElementType = 'div'> {
3131
props: P &
3232
Pick<InputProps, InputRootKeys> & {
33-
components?: {
34-
Root?: React.ElementType;
35-
Label?: React.ElementType;
36-
Input?: React.ElementType;
37-
HelperText?: React.ElementType;
33+
slots?: {
34+
root?: React.ElementType;
35+
label?: React.ElementType;
36+
input?: React.ElementType;
37+
helperText?: React.ElementType;
3838
};
3939
slotProps?: {
4040
root?: React.ComponentPropsWithRef<'div'>;

0 commit comments

Comments
 (0)