diff --git a/packages/material-ui/src/FormControl/FormControl.js b/packages/material-ui/src/FormControl/FormControl.js index 54b617ad3aa08c..2aa6d4dc6b252b 100644 --- a/packages/material-ui/src/FormControl/FormControl.js +++ b/packages/material-ui/src/FormControl/FormControl.js @@ -162,6 +162,7 @@ const FormControl = React.forwardRef(function FormControl(props, ref) { error, filled, focused, + fullWidth, hiddenLabel, margin: (size === 'small' ? 'dense' : undefined) || margin, onBlur: () => { diff --git a/packages/material-ui/src/FormControl/FormControl.test.js b/packages/material-ui/src/FormControl/FormControl.test.js index 617275af8be094..cf015c4fe924a5 100644 --- a/packages/material-ui/src/FormControl/FormControl.test.js +++ b/packages/material-ui/src/FormControl/FormControl.test.js @@ -224,6 +224,16 @@ describe('', () => { setProps({ margin: 'dense' }); expect(formControlRef.current).to.have.property('margin', 'dense'); }); + + it('should have the fullWidth prop from the instance', () => { + const formControlRef = React.createRef(); + const { setProps } = render(); + + expect(formControlRef.current).to.have.property('fullWidth', false); + + setProps({ fullWidth: true }); + expect(formControlRef.current).to.have.property('fullWidth', true); + }); }); describe('callbacks', () => { diff --git a/packages/material-ui/src/FormControl/useFormControl.d.ts b/packages/material-ui/src/FormControl/useFormControl.d.ts index 26bc16c0dd01b6..493cff9159bb23 100644 --- a/packages/material-ui/src/FormControl/useFormControl.d.ts +++ b/packages/material-ui/src/FormControl/useFormControl.d.ts @@ -4,7 +4,14 @@ import { FormControlProps } from './FormControl'; // shut off automatic exporting export {}; -type ContextFromPropsKey = 'disabled' | 'error' | 'hiddenLabel' | 'margin' | 'required' | 'variant'; +type ContextFromPropsKey = + | 'disabled' + | 'error' + | 'fullWidth' + | 'hiddenLabel' + | 'margin' + | 'required' + | 'variant'; export interface FormControlState extends Pick { adornedStart: boolean;