Skip to content

Commit b780412

Browse files
committed
pass true to renderInput if prop is not received
1 parent 0500005 commit b780412

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

docs/pages/material-ui/api/autocomplete.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"default": "'auto'"
6060
},
6161
"freeSolo": { "type": { "name": "bool" }, "default": "false" },
62-
"fullWidth": { "type": { "name": "bool" }, "default": "true" },
62+
"fullWidth": { "type": { "name": "bool" }, "default": "false" },
6363
"getLimitTagsText": {
6464
"type": { "name": "func" },
6565
"default": "(more) => `+${more}`",

packages/mui-material/src/Autocomplete/Autocomplete.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export interface AutocompleteProps<
246246
forcePopupIcon?: true | false | 'auto';
247247
/**
248248
* If `true`, the input will take up the full width of its container.
249-
* @default true
249+
* @default false
250250
*/
251251
fullWidth?: boolean;
252252
/**

packages/mui-material/src/Autocomplete/Autocomplete.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ const Autocomplete = React.forwardRef(function Autocomplete(inProps, ref) {
439439
filterSelectedOptions = false,
440440
forcePopupIcon = 'auto',
441441
freeSolo = false,
442-
fullWidth = true,
442+
fullWidth = false,
443443
getLimitTagsText = (more) => `+${more}`,
444444
getOptionDisabled,
445445
getOptionKey,
@@ -677,7 +677,7 @@ const Autocomplete = React.forwardRef(function Autocomplete(inProps, ref) {
677677
{renderInput({
678678
id,
679679
disabled,
680-
fullWidth,
680+
fullWidth: props.fullWidth ?? true,
681681
size: size === 'small' ? 'small' : undefined,
682682
InputLabelProps: getInputLabelProps(),
683683
InputProps: {
@@ -937,7 +937,7 @@ Autocomplete.propTypes /* remove-proptypes */ = {
937937
freeSolo: PropTypes.bool,
938938
/**
939939
* If `true`, the input will take up the full width of its container.
940-
* @default true
940+
* @default false
941941
*/
942942
fullWidth: PropTypes.bool,
943943
/**

packages/mui-material/src/Autocomplete/Autocomplete.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3040,13 +3040,13 @@ describe('<Autocomplete />', () => {
30403040
expect(renderInput.lastCall.args[0].fullWidth).to.equal(false);
30413041
});
30423042

3043-
it('should have fullWidth by default', () => {
3043+
it('should pass fullWidth as true to renderInput if not provided', () => {
30443044
const renderInput = spy((params) => <TextField {...params} />);
30453045
const view = render(
30463046
<Autocomplete options={[0, 10, 20]} renderInput={renderInput} value={null} />,
30473047
);
30483048

3049-
expect(view.container.querySelector(`.${classes.root}`)).to.have.class(classes.fullWidth);
3049+
expect(view.container.querySelector(`.${classes.root}`)).not.to.have.class(classes.fullWidth);
30503050
expect(renderInput.lastCall.args[0].fullWidth).to.equal(true);
30513051
});
30523052
});

0 commit comments

Comments
 (0)