question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Autocomplete] Multiple with many options take too much space

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

Currently for an Autocomplete with the multiple option, the height of the autocomplete will grow as more items are selected and more chips are displayed. It would be useful to have an option to limit the number of rows of chips that can be displayed, so that a vertically growing list of chips will not disrupt the layout of the rest of the page.

Examples 🌈

Here is the current behavior from material-ui component demo: Screen Shot 2020-01-08 at 6 09 34 PM

Here is a design spec for multi-line that has vertical scrolling rather than horizontal (this is actually what we were asked to implement) Screen Shot 2020-01-08 at 6 17 34 PM

The material design specification on Input Chips has a section labeled “Placement” that indicates that chips can appear in a horizontal scrollable list, which is slightly different but might work for us as well.

https://material.io/components/chips/#input-chips

Motivation 🔦

In our application design we have many multiple select auto complete filter boxes in a grid and we don’t want the layout to be disrupted by displaying a lot of chips. We love your new Autocomplete component and this seemed like a useful feature or at least one that would make our designer happy.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:13
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

17reactions
msniezynskicommented, Apr 23, 2020

Is it possible to set maximum number of tags that will be visible when focused?

11reactions
Jaskervcommented, Feb 7, 2020

I found a temporary solution.

In your renderInput

 renderInput={ params => {
        const { InputProps, ...restParams } = params;
        const { startAdornment, ...restInputProps } = InputProps;
        return (
          <TextField
            { ...restParams }
            InputProps={ {
              ...restInputProps,
              startAdornment: (
                <div style={ {
                  maxHeight: <INSERT MAX HEIGHT>,
                  overflowY: 'auto',
                } }
                >
                  {startAdornment}
                </div>
              ),
            } }
          />
        );
      } }

Result: image

Let me know if this works for you 😃

If you found a way to replace maxHeight in px to maxHeight to rowsMax, let me know

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Autocomplete] Multiple with many options take too much space
Currently for an Autocomplete with the multiple option, the height of the autocomplete will grow as more items are selected and more chips...
Read more >
Truncate value of Material UI Autocomplete (replicate Material ...
With Material UI Multiple Select , you can truncate the value shown after selection, rather than going to another line (by setting the ......
Read more >
Using Material UI's Autocomplete to Build a Count-Limited ...
Material UI's Autocomplete is a useful tool when providing users of your application the ability to select options from a list of values....
Read more >
A Guide on Material UI AutoComplete in React - Refine Dev
The <Autocomplete /> component is best used for modifying single-line textbox values to accommodate more options. The component's value is ...
Read more >
React Autocomplete component - Material UI - MUI
The autocomplete is a normal text input enhanced by a panel of suggested options. The widget is useful for setting the value of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found