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.

[Skeleton] Not working with styleOverrides

See original GitHub issue
    MuiSkeleton: {
      defaultProps: {
        animation: 'wave'
      },
      styleOverrides: {
        root: {
          backgroundColor: 'red !important' // not apply 
        }
      }
    }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
glocorecommented, Feb 17, 2021

I’m working on this issue!

0reactions
oliviertassinaricommented, Feb 16, 2021

Ok, there are a couple of issues. I would propose this fix:

diff --git a/packages/material-ui/src/Skeleton/Skeleton.js b/packages/material-ui/src/Skeleton/Skeleton.js
index 24f402b676..9bd38aa15e 100644
--- a/packages/material-ui/src/Skeleton/Skeleton.js
+++ b/packages/material-ui/src/Skeleton/Skeleton.js
@@ -70,8 +70,7 @@ const waveKeyframe = keyframes`
 const SkeletonRoot = experimentalStyled(
   'span',
   {},
-  { name: 'MuiSkeleton', slot: 'Root' },
-  overridesResolver,
+  { name: 'MuiSkeleton', slot: 'Root', overridesResolver },
 )(
   ({ theme, styleProps }) => {
     const radiusUnit = getUnit(theme.shape.borderRadius) || 'px';
diff --git a/packages/material-ui/src/Skeleton/Skeleton.test.js b/packages/material-ui/src/Skeleton/Skeleton.test.js
index 2f89484cdd..19d43cb49f 100644
--- a/packages/material-ui/src/Skeleton/Skeleton.test.js
+++ b/packages/material-ui/src/Skeleton/Skeleton.test.js
@@ -1,6 +1,6 @@
 import { expect } from 'chai';
 import * as React from 'react';
-import { createClientRender, createMount, describeConformance } from 'test/utils';
+import { createClientRender, createMount, describeConformanceV5 } from 'test/utils';
 import Skeleton from './Skeleton';
 import classes from './skeletonClasses';

@@ -8,14 +8,14 @@ describe('<Skeleton />', () => {
   const mount = createMount();
   const render = createClientRender();

-  describeConformance(<Skeleton />, () => ({
+  describeConformanceV5(<Skeleton />, () => ({
     classes,
     inheritComponent: 'span',
     mount,
     refInstanceof: window.HTMLSpanElement,
     muiName: 'MuiSkeleton',
     testVariantProps: { variant: 'circular', animation: 'wave' },
-    skip: ['componentProp', 'componentsProp'],
+    skip: ['componentsProp'],
   }));

   it('should render', () => {
diff --git a/packages/material-ui/src/styles/components.d.ts b/packages/material-ui/src/styles/components.d.ts
index 6adecbe35b..4a3400db9b 100644
--- a/packages/material-ui/src/styles/components.d.ts
+++ b/packages/material-ui/src/styles/components.d.ts
@@ -316,6 +316,10 @@ export interface Components {
     defaultProps?: ComponentsProps['MuiSelect'];
     styleOverrides?: ComponentsOverrides['MuiSelect'];
   };
+  MuiSkeleton?: {
+    defaultProps?: ComponentsProps['MuiSkeleton'];
+    styleOverrides?: ComponentsOverrides['MuiSkeleton'];
+  };
   MuiSlider?: {
     defaultProps?: ComponentsProps['MuiSlider'];
     styleOverrides?: ComponentsOverrides['MuiSlider'];
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Skeleton] Not working with styleOverrides #24959 - GitHub
bug Something isn't working component : skeleton This is the name of the generic UI component, not the React module! good first issue ......
Read more >
Skeleton API - Material UI - MUI
The name MuiSkeleton can be used when providing default props or style overrides in the theme. Props. Props of the native component are...
Read more >
Mui V5: theme override gives unexpected result. Why?
If I do this in my project, then this does not work. For a TextField component the div that is impacted is enter...
Read more >
Material UI style overrides don't work? : r/reactjs - Reddit
I'm trying to override the selected state of the ToggleButton inside a ToggleButtonGroup using the styleOverrides but can't seem to override ...
Read more >
Problem with width default stylesheet skeleton style
I do have a problem with the Default stylesheet skeleton style as it seems ... I tried to figure out if I could...
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