React Material UI: How to use material-ui platinum themes? - reactjs

I am trying to use one of the platinum themes from React Material-UI, link below:
https://material-ui.com/premium-themes/
but I can't find instructions for how to use them in my application. Can someone explain how can I use a platinum theme in my React application?

To use one of the free premium themes, just click the link to go to the "Source Code" and then you can look at the code for the example. For instance, for the Paperbase theme you can find the source code for the theme here: https://github.com/mui-org/material-ui/blob/master/docs/src/pages/premium-themes/paperbase/Paperbase.js.
Just copy the parts you want to leverage into your own project and then you can modify it as desired.

Related

How to handle design system in micro-frontends?

In the micro-frontend every application would be running separately, in that case, each one of the applications will be having its own CSS.
Let's assume we are taking MUI as the UI library. So each application that uses MUI will be having its own theme provider.
Now the stakeholder wants to change the button's color from blue to black, in this scenario I have to manually go and change the color to each one of the applications separately.
Do we have to do like this only or any other pattern is available in Micro-Frontend to solve this Design System issue?
Please help me with your suggestions !
You can create a theming package for your micro-frontend apps. This package provides a theme object for Mui ThemeProvider. It can have some default theme properties and some additional (editable) properties which from an API.
Then you need a portal where your client or stakeholder can edit the theme, from some theme editor app. Basically, that will UPDATE your theme object (database).
Your package will GET those changes and update all your micro-frontend apps. I have seen a similar kind of implementation in a Turborepo app.

How can I style a React component that does not use Material UI elements with Material UIs style system?

Material UIs (MUI's) documentation is perfectly broken here: At
https://mui.com/system/getting-started/overview/#all-inclusive
the last line reads:
"See ->Advanced for details on how to use MUI System with non-MUI components."
Yet the link to Advanced is dead as of today (404). Is there a way to use the style system outside of MUIs components?
I think that's the Custom Components page, it was fixed here but not live yet I guess

Does MUI v5 provides example of theme or styles that they are using for their home page?

MUI team have very attractive example in their homepage
And I want to know does they provide some of examples what styling or theme that they are using? Do they have some codesandbox something? I tried a lot of example but always show default material style!
MUI is an open source project, including its docs website. You can see the project on Github here. The components in the landing page are customized in this file.
You can access the MUI theme object directly in the mui.com console

Material UI theme not being picked up by third party component

I have been working on this Material UI Rich Text Editor over here
https://www.npmjs.com/package/material-ui-rte
I'm trying to follow best practices for both React and Material-UI so that anyone can pick it up and drop it in their project and it just works with Material
I'm having an issue where after running my build script and trying to actually import the editor into a project, I'm not getting any theme passed into the components in the editor, so palette colors or font families are not being represented in the editor at all which I thought they would be
When actually cloning the repo and running the start script, playing with the demo works with the theme when pulling the Editor from the src component but pulling it in from the lib directory like a normal use case would does not work with the theme.
Here is a codesandbox to illustrate this, I've set the theme to have a text color of lime green and the editor is not rendering this color at all. But if you clone and run the actual repo, the editor does use the lime color
https://codesandbox.io/embed/create-react-app-dw7gh
I would love some direction on this. Am I doing something wrong or missing something that material expects? Did I set up my build script wrong?
The theme propagation relies on a singleton to work. I would encourage the usage of #material-ui/styles as a peer dependency. Right now, it seems that you publish it: https://unpkg.com/material-ui-rte#1.1.3/lib/index.js. You should change that.

How to use animated material ui icons in React

https://material.io/design/iconography/animated-icons.html
I attached link above how can i integrated icon in my react application there is not have any code.
I think it is not supported out of the box by material-ui, but you can use css transitions to accomplish it.
Maybe this lib can solve it for you or at least inspire your implementation?
https://mui.wertarbyte.com/#material-ui-toggle-icon
Their implementation looks pretty nice, well documented and MIT: https://github.com/TeamWertarbyte/material-ui-toggle-icon
Google Material does not provide an implementation of their icons with animations. They do; however, provide a specification/guideline for animation with Material Icons.
In addition; you can download the SVG Icons here as needed: https://material.io/tools/icons/
and import into your code.

Resources