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.

SxProps doesn't exist in @mui/material/styles

See original GitHub issue

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

when you type import { SxProps, Theme } from '@mui/material/styles';

The Typescript linter complains: Module '"@mui/material/styles"' has no exported member 'SxProps'.

This is happening in the new version @mui/material v5.2.4

Expected behavior 🤔

To SxProps to exists in package @mui/material/styles as it’s told in the official documentation: https://mui.com/system/the-sx-prop/#passing-sx-prop

Steps to reproduce 🕹

Steps:

  1. Install latest @mui/material
  2. type import { SxProps, Theme } from '@mui/material/styles';
  3. check errors with the TS linter in VSC

Context 🔦

I was trying to pass the sx props as recommended in the documentation

Your environment 🌎

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
alexservercommented, Dec 15, 2021

Doing some inspection, I found that SxProps is in package @mui/system, so either you move an export to @mui/styles or change the documentation, because somehow the TS linter is crashing and complaining.

import { SxProps } from '@mui/system';
import { Theme } from '@mui/material/styles';
0reactions
mnajdovacommented, Feb 9, 2022

I am closing as there was no reproduction provided. If you have a new one, please re-open the issue and add a link to repository.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SxProps doesn't exist in @mui/material/styles #30229 - GitHub
The Typescript linter complains: Module '"@mui/material/styles"' has no exported member 'SxProps'. This is happening in the new version ...
Read more >
The sx prop - MUI System
The sx prop is a shortcut for defining custom styles that has access to the theme. The sx prop lets you work with...
Read more >
MUI TextField sx props does not apply styles - Stack Overflow
I'm using MUI v5. If I inspect the input element, the styles are not applied. What am I missing? UPDATE: it seems the...
Read more >
The `sx` Prop - Theme UI
The sx prop lets you add any valid CSS to an element, while using values from your theme to keep styles consistent. You...
Read more >
How to use the sx prop in MUI v5. Still using makeStyles?
How can we fix this using MUI styling? makeStyles and useStyles hooks in v4. Material UI v4 has multiple ways to style components...
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