Skip to content

Commit

Permalink
fix: add test file
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Hutchinson committed Sep 7, 2024
1 parent e307caa commit 556caeb
Showing 1 changed file with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import * as React from 'react';
import {
IconButtonProps,
svgIconClasses,
Autocomplete,
IconButton,
TextField,
} from '@mui/material';

declare module '@mui/material/Autocomplete' {
interface AutocompletePopupIndicatorSlotPropsOverrides {
iconSize: 'small' | 'medium' | 'large';
}
}

type CustomIconButtonProps = IconButtonProps<
'button',
{
iconSize?: 'small' | 'medium' | 'large';
}
>;

const CustomIconButton = ({ iconSize, ...other }: CustomIconButtonProps) => {
return (
<IconButton
{...other}
sx={{
[`.${svgIconClasses.root}`]: {
fontSize: iconSize === 'small' ? '1rem' : '1.5rem',
},
}}
/>
);
};

<Autocomplete
options={['Option 1', 'Option 2', 'Option 3']}
renderInput={(params) => <TextField {...params} />}
slots={{
popupIndicator: CustomIconButton,
}}
slotProps={{
popupIndicator: {
iconSize: 'large',
},
}}
/>;

0 comments on commit 556caeb

Please sign in to comment.