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.

[v5-next] MuiSelect styleOverrides not being rendered

See original GitHub issue

The styles applied in the stylesOverrides are not being shown on the Select components.

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

The component renders without custom styling applied.

Expected Behavior 🤔

The component should have custom styling applied from the theme.

Steps to Reproduce 🕹

CodeSandbox.io

Check out the App.js file; within the theme you should see defaultProps and overrideStyles written but only defaultProps being applied.

Context 🔦

Trying to apply the styles globally to remove code repitition.

Your Environment 🌎

`npx @material-ui/envinfo`
  System:
    OS: macOS 12.0
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
    Memory: 41.63 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.16.0 - ~/.nvm/versions/node/v14.16.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.11.0 - ~/.nvm/versions/node/v14.16.0/bin/npm
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
    Homebrew: 3.1.2 - /usr/local/bin/brew
    pip3: 20.2.3 - /usr/local/bin/pip3
    RubyGems: 3.0.3 - /usr/bin/gem
  Utilities:
    Make: 3.81 - /usr/bin/make
    GCC: 4.2.1 - /usr/bin/gcc
    Git: 2.23.0 - /usr/local/bin/git
    Clang: 12.0.5 - /usr/bin/clang
  Servers:
    Apache: 2.4.48 - /usr/sbin/apachectl
  SDKs:
    iOS SDK:
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Nano: 2.0.6 - /usr/bin/nano
    Vim: 8.2 - /usr/bin/vim
    Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
  Languages:
    Bash: 3.2.57 - /bin/bash
    Java: 13.0.1 - /usr/bin/javac
    Perl: 5.30.3 - /usr/bin/perl
    Protoc: 3.13.0 - /usr/local/bin/protoc
    Python: 2.7.16 - /usr/bin/python
    Python3: 3.8.6 - /usr/local/bin/python3
    Ruby: 2.6.3 - /usr/bin/ruby
  Databases:
    MySQL: 10.15 - /usr/local/bin/mysql
    SQLite: 3.35.3 - /usr/bin/sqlite3
  Browsers:
    Chrome: 90.0.4430.212
    Edge: 88.0.705.74
    Firefox: 87.0
    Safari: 15.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
aidanm1999commented, Jul 13, 2021

Thanks for all your help @mnajdova. For reference, I ended up with the following code in the theme which produced the outlook I was aiming to achieve:

MuiSelect: {
    defaultProps: {
        variant: "outlined",
        size: "small",
        native: true,
        IconComponent: KeyboardArrowDownRounded,
    },
},
MuiOutlinedInput: {
    styleOverrides: {
        root: {
            fontSize: "0.9rem !important",
            fontFamily: Font.SemiBold,
            borderRadius: 100,
            padding: 0,
            borderColor: Colors.LightGrey,
        },
    },
},
MuiNativeSelect: {
    styleOverrides: {
        select: {
            padding: "6px 28px 4px 12px !important",
        },
    },
},
Screenshot 2021-07-13 at 3 53 58 pm
0reactions
mnajdovacommented, Jul 13, 2021

Looks the changes are applied in the migration-v4.md guide, I will be closing this one. @aidanm1999 feel free to re-open if there is anything else we may have missed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mui v5 styleOverrides not working with themes - Stack Overflow
The approach below targets the same element as MuiSelect-root by leveraging MuiInput-root (the rendering of the root element of the Select ...
Read more >
[Select] style overrides overwritten by hardcoded values #25763
With the move to using emotion MuiSelect styleOverrides are being overwritten. CodeSandbox ... Our Select styles are not being applied to our component ......
Read more >
Server rendering - Material UI - MUI
The most common use case for server-side rendering is to handle the initial render when a user (or search engine crawler) first requests...
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