Difference between #material-ui vs material-ui (without at-sign) - reactjs

Just starting (again) with material UI and react. There are two packages material-ui and #material-ui, which is the best starting point (latest) as of 2019-07 timeframe?
I think it is npm install #material-ui/core based on ... https://material-ui.com/getting-started/installation/. The GIT repo is at https://github.com/mui-org/material-ui
Simple question, hopefully simple answer.
Other questions I looked at:
Use Create-React-App with Material UI - This answer says to use npm install --save material-ui but because it is 2 years old, I think it may be out of date.
Difference between Material-Ui and Material-Ui-Next
How to install Material-UI Docs WITHOUT installing material-ui?

#material-ui/core is the correct one to use for v4. For v5, the equivalent package is #mui/material.
If you go to https://www.npmjs.com/package/material-ui, you'll see that material-ui is deprecated. The last stable version in the material-ui package was 0.20.2. For the 1.0 release it moved to #material-ui/core and for the stable release of v5 it moved to #mui/material.
The #material-ui scope (for v4) is used for the following packages that are all managed within the monorepo you referenced (https://github.com/mui-org/material-ui/tree/v4.12.3/packages):
#material-ui/core
#material-ui/icons
#material-ui/styles
#material-ui/system
#material-ui/lab
#material-ui/utils
#material-ui/types
#material-ui/docs
#material-ui/codemod
Similarly, the #mui scope (for v5) is used for the similar set of packages supported for v5 (https://github.com/mui-org/material-ui/tree/master/packages):
#mui/material
This is the equivalent of #material-ui/core
#mui/core
This is the NOT the equivalent of #material-ui/core. #mui/core is a new package for unstyled (no Material-Design CSS applied) versions of the components.
#mui/icons-material
#mui/styles
This is for supporting the withStyles and makeStyles JSS-backed styling APIs and is not recommended for use in new projects.
#mui/system
#mui/lab
#mui/utils
#mui/types
#mui/docs
#mui/codemod

The # scope indicates package ownership
The main advantage of scopes I've seen so far is that each scope is controlled by npm account of an organization / user, much like GitHub usernames / organization names.
This way, it makes it easy to determine if the package you are looking at belongs to an organization you trust, or if it is a third party tool.
For example, if you see:
#material-ui
then you know that it comes from the material-ui team and can be trusted.
On the other hand, the same could not be said about:
material-ui
For more https://docs.npmjs.com/about-scopes

Related

package.json how to deprecate a project dependency?

Is it possible to mark a project dependency as deprecated without removing it from the project.
So other developers don't use it in future
I have a project that was built on Material-UI V4 and have recently added Mui-V5 with the intention that all new work is built on V5. I'd like developers to see an IDE warning when they import components from the old dependency.
One thought I had is to use patch-package to modify Mui-V4 and set it as deprecated in package.json but this warning only shows on npm install.

anyone can help me to use material icons in react project

I have imported two material icons packages
"#material-ui/core": "^4.12.3",
"#material-ui/icons": "^4.11.2"
but the code is not working it shows me errors like a module not found so what do I need to do?
npm install #material-ui/icons
npm install #material-ui/core
i have installed abowe two packeges.
[below is the error of my project]
Material UI with v5 did a rebranding to move away from just "material" and is now called "MUI".
This means, their npm packages have too been renamed.
If you goto #material-ui/core in npm you can see this notice
This package has been deprecated
You can now upgrade to #mui/material. See the guide: https://mui.com/guides/migration-v4/
In this case, assume you are importing icons as suggested in https://mui.com/components/material-icons which uses v5 where as installed packages are v4 (with #material scope)
You have couple of options:
upgrade all packages to v5 (ie, #mui scope) if you want to use mui v5. Do note, you have to install couple of additional dependencies as well - #emotion/react #emotion/styled as MUI is now based on emotion.
or, update import to #material-ui/icons as mentioned here - https://v4.mui.com/components/material-icons/
I guess the new way to install material UI is npm install #mui/icons-material. try it out.

Module not found: Can't resolve '#mui/x-data-grid' in 'C:\Users\Syndicate\Documents\GitHub\simserp\sims\src\components\modules\country'

enter image description here
I was working on the "#material-ui/core": "^4.12.3" version, and now the version is changed. I am looking the way for :
import { GridOverlay, DataGrid } from '#mui/x-data-grid';
But it is not working.
can anyone help me in setting up both the version and documentation for the older version so that I go with both version in my application.
TL;DR
Step 1.
// with npm
npm install #mui/material #emotion/react #emotion/styled
// with yarn
yarn add #mui/material #emotion/react #emotion/styled
Step 2.
// with npm
npm install #mui/x-data-grid
// with yarn
yarn add #mui/x-data-grid
Step 3.
import { DataGrid } from '#mui/x-data-grid'
Long Text
Our company also encountered the same problem when migrating, and finally solved it perfectly.
The reason for the above error is because #mui/x-data-grid is dependent on MUI v5, so you have to install it, or you can be used with MUI v4 with some additional steps.
This is a reference guide for upgrading your site from MUI X v4 to v5. MUI X v5 is fully compatible with MUI Core (includes Material UI) v5 and can be used with MUI Core v4 with some additional steps. Most breaking changes are renaming of CSS classes or variables to improve the consistency of the grid.
Refer to MUI doc
You may be wondering, but what should I do if I use mui v4 now?
According to our actual experience and the information provided by the official Material, it is no problem to have the v4 package and the v5 package at the same time, so you can install the MUI v5 first and let #mui/ x-data-grid can be used, waiting for the spare time to migrate the v4 components to the v5 usage.
We strongly recommend you migrate MUI Core to v5 when using MUI X v5. However, this might not be possible, depending on the complexity of the application. The alternative is to install MUI Core v5 and configure it to keep MUI Core v4 running alongside.
Refer to MUI doc
Module not found: Can't resolve '#mui/x-data-grid'
Means you don't have this module installed
If you find this error for any other modules meaning is the same you have to install that specific module
npm install #mui/x-data-grid
npm i #mui/x-data-grid install this one first
Even if you have installed the dependency #mui/x-data-grid VS Code may nag you with this error, the solution is to restart the VS Code.

What is the difference between #material-ui and #mui

I found that the Official Website of Material UI is using #material-ui and #mui.
But I find that If I use #material-ui or #mui Textfield, the UI doesn't works and the problems are mentioned below
React - Material label not in right position in Textfield
If you search Material UI in google, and go to https://mui.com/, it tells you to npm install #mui/material. But few weeks ago, I am using npm install #material-ui
If I have both #material-ui and #mui in my package.json, and I include both script and stylesheet in index.html, will there be any conflicts which mess up the UI
Update 1
In #mui CodeSandbox,
If you try Textfield with select prop, when you open the select, overflow: hidden will be added in body.
https://codesandbox.io/s/selecttextfields-material-demo-forked-z6b9f?file=/demo.js
In my project,
overflow: hidden; padding: 15px is added in body, but I checked I've done nothing about this!
material-ui version 1-4 are available on NPM under #material/core and versions >4 are available under #mui/material. Same library, but they changed the name in version 5.
Since Sep 16, 2021 Material-UI changed his name to MUI to differentiate the company from Google. They say on the blog:
We are breaking the strong association with Material Design as we have
seen too many people confusing Material-UI with Google, or as a
synonym of Material Design.
Blog post here: https://mui.com/blog/material-ui-is-now-mui/
From version 5 the packages stored under #mui as you can found in documentation and you must use npm install #mui/material instead of #material-ui/core.
Material ui has upgraded to V5 as per the recent tweet :https://twitter.com/MaterialUI/status/1438518915236126723?s=20

Can I add only Material-UI Lab to my project without installing Core?

I want to use the Slider component from Material UI in my React app.
The Slider is part of 'Lab', a 'package that hosts the incubator components that are not yet ready to move to the core.'
npm install #material-ui/lab
npm install #material-ui/core
Do I still need to install Core Material UI to my project or can I only add the Lab?
I do not want to add more bulk to my already big project.
#material-ui/lab have dependency on #material-ui/core, so you must need to added #material-ui/core.it's your choice how you added npm install or cdn
here some useful for you i guess:
#material-ui/core cdn reference: Here
#material-ui/lab cdn reference: Here
or you can try ant.design
they have some awesome tools for you.
Thank You :)
#material-ui/lab has #material-ui/core as a peer dependency. So yes you do need to add it. However if you're concerned about bundle size then rest assured that importing a lab component will not add the complete core to the bundle. It will only add what's necessary.

Resources