Skip to content

Commit

Permalink
[material-ui][InputBase] Add sx type to input , root slot (#39569)
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 committed Nov 2, 2023
1 parent d886129 commit a1cc186
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/mui-material/src/InputBase/InputBase.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ export interface InputBaseProps
* @default {}
*/
slotProps?: {
root?: React.HTMLAttributes<HTMLDivElement> & InputBaseComponentsPropsOverrides;
input?: React.InputHTMLAttributes<HTMLInputElement> & InputBaseComponentsPropsOverrides;
root?: React.HTMLAttributes<HTMLDivElement> &
InputBaseComponentsPropsOverrides & { sx?: SxProps<Theme> };
input?: React.InputHTMLAttributes<HTMLInputElement> &
InputBaseComponentsPropsOverrides & { sx?: SxProps<Theme> };
};
/**
* The components used for each slot inside.
Expand Down
16 changes: 16 additions & 0 deletions packages/mui-material/src/InputBase/InputBase.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,19 @@ import InputBase from '@mui/material/InputBase';
expectType<React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, typeof event>(event);
}}
/>;

// Tests presence of `sx` prop on input and root slot
<InputBase
slotProps={{
input: {
sx: {
background: 'white',
},
},
root: {
sx: {
background: 'black',
},
},
}}
/>;

0 comments on commit a1cc186

Please sign in to comment.