Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated main readme #2

Merged
merged 5 commits into from
Oct 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,37 @@
This project has an [npm library](https://www.npmjs.com/package/@react-m3/m3) for [Material 3](https://m3.material.io/) theme, so you can add to your project and play-around this theme
created on the top of `@mui/material`.


```shell
npm i @react-m3/m3
```

## Apply this custom theme in your project

```typescript jsx
import { useMemo } from 'react';
import { CssBaseline, ThemeProvider } from '@mui/material';
import { getPalette, getTheme } from '@react-m3/m3';

const color = "#6750a4";

export const MyCustomTheme = () => {

const m3Theme = useMemo(() => {
const palette = getPalette(color);
return getTheme('light', palette);
}, [color]);

return (
<ThemeProvider theme={m3Theme}>
<CssBaseline enableColorScheme/>
{/* Call your app component here */}
<MyApp/>
</ThemeProvider>
);
}
```

> [!NOTE]
> Open the next [StackBlitz Example.](https://stackblitz.com/edit/react-m3-theme?file=src%2FApp.tsx)