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.

[IconButton] Improve size values

See original GitHub issue

Current Behavior 😯

When giving IconButton size properties medium and larger the size class is not set.

Screenshot 2020-12-18 at 15 02 30

Expected Behavior 🤔

That MuiIconButton get MuiIconButton-sizeMedium and MuiIconButton-sizeLarge the same way as MuiIconButton-sizeSmall

Steps to Reproduce 🕹

<IconButton size="large">
  <FontAwesomeIcon icon={faPlay} />
  <FontAwesomeIcon icon={faChevronRight} />
</IconButton>
<IconButton size="medium">
  <FontAwesomeIcon icon={faPlay} />
  <FontAwesomeIcon icon={faChevronRight} />
</IconButton>

Your Environment 🌎

`System: OS: macOS 11.0.1 Binaries: Node: 12.18.4 - /usr/local/bin/node Yarn: 1.22.5 - ~/.yarn/bin/yarn npm: 6.14.9 - /usr/local/bin/npm Browsers: Chrome: 87.0.4280.88 * Edge: Not Found * Firefox: Not Found Safari: 14.0.1 npmPackages: @emotion/styled: 10.0.27 @material-ui/core: ^4.11.2 => 4.11.2 @material-ui/styles: 4.11.2 @material-ui/system: 4.11.2 @material-ui/types: 5.1.0 @material-ui/utils: 4.11.2 @types/react: ^16.9.53 => 16.14.2 react: ^17.0.1 => 17.0.1 react-dom: ^17.0.1 => 17.0.1 styled-components: ^5.2.1 => 5.2.1 typescript: ^4.0.3 => 4.1.3 `

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
oliviertassinaricommented, Jun 7, 2021

In my opinion, it makes sense for us now to generate all class names, both for the default and non-default props values.

@mnajdova I would personally encourage we follow Bootstrap, reducing the number of classname anytime there is an opportunity for, example designers don’t need size medium, they can customize the default styles.

Regarding the size of the IconButton, Material Design does no longer document this component. It seems that we can take some freedom. I have noticed that Google, on its product on desktop is reducing the size of the element. If you take Google Calendar, alone, you can find 5 different sizes:

  • Capture d’écran 2020-12-23 à 13 14 32
  • Capture d’écran 2020-12-23 à 13 14 42
  • Capture d’écran 2020-12-23 à 13 15 36
  • Capture d’écran 2020-12-23 à 13 14 59
  • Capture d’écran 2020-12-23 à 13 28 58

I think that we should do the following:

  • small: 32px -> padding: 5px
  • medium: 40px -> padding: 8px (default)
  • large: 48px -> padding 12px

@hpeide Do you want to work on the problem? The current default at 48px is too much.

2reactions
mnajdovacommented, Dec 23, 2020

In my opinion, it makes sense for us now to generate all class names, both for the default and non-default props values. The biggest reason for it is, if someone changes their defaults, for example, their default size to be large, they wouldn’t be able to change the styles for the medium as they will not be able to select an appropriate global class name. For v5 at least we will make sure that we have global classes for all states, both default and non default.

Regarding the size for the IconButton, I think it would make sense that we support three sizes, as we do with the other buttons.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[IconButton] Improve size values · Issue #24045 · mui/material-ui
Current Behavior When giving IconButton size properties medium and larger the size class is not set.
Read more >
The Essential Guide to MUI Icon and IconButton Size and Styling
Learn how to customize MUI Icon size and IconButton size, width, height, text color, background color and border.
Read more >
How to resize (height and width) of an IconButton in Flutter
You can force it to size itself with the SizedBox. new SizedBox( height: 18.0, width: 18.0, child: new IconButton( padding: new ...
Read more >
How To Change Flutter Icon Button Size [Easy Flutter Guide]
First we will see the default Flutter icon button size then we will change it using an easy Flutter example.
Read more >
IconButton class - material library - Flutter - Dart API docs
A static convenience method that constructs an icon button ButtonStyle given simple values. This method is only used for Material 3.
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