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

[docs] Add live Tailwind CSS demo #30966

Merged

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Feb 7, 2022

@oliviertassinari oliviertassinari added the docs Improvements or additions to the documentation label Feb 7, 2022
@mui-bot
Copy link

mui-bot commented Feb 7, 2022

No bundle size changes

Generated by 🚫 dangerJS against bb20d07

**App.js**
{{"demo": "StyledComponents.js", "hideToolbar": true}}

[![Edit on StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/github-ndkshy?file=pages%2Findex.tsx)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have this in the examples too? What was the reason you decided this to be available on StackBlitz only?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know we had this folder.

Copy link
Member Author

@oliviertassinari oliviertassinari Feb 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have this in the examples too?

The Tailwind CSS demo doesn't work with them, for some reason

What was the reason you decided this to be available on StackBlitz only?

Codesandbox is slow as hell with Next.js

Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look great

If you are used to Tailwind CSS and want to use it together with the MUI components, you can start by cloning the [Tailwind CSS](https://github.com/mui/material-ui/tree/master/examples/tailwind) example project.
If you use a different framework, or already have set up your project, follow these steps:

1. Add Tailwind CSS to your project, following the instructions in https://tailwindcss.com/docs/installation.
2. Remove Tailwind's `base` directive in favor of the `CSSBaseline` component provided by `@mui/material`, as it plays nicer with the MUI components.
2. Remove Tailwind's `base` directive in favor of the `CssBaseline` component provided by `@mui/material`, as it plays nicer with the MUI components.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong component name

@@ -693,7 +701,8 @@ import Slider from '@mui/material/Slider';
export default function App() {
return (
<div>
<Slider defaultValue={30} className="color-indigo-500" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

color-indigo-500 this doesn't exist.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops, it should have been text-indigo-500 I guess.

@@ -13,7 +13,7 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve"
"jsx": "react"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the export with Stackblitz and Codesandbox.

@@ -21,6 +21,7 @@
"react-dom": "latest"
},
"devDependencies": {
"@types/node": "latest",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the export with Stackblitz and Codesandbox.

@@ -22,22 +21,19 @@ function Copyright() {
export default function App() {
return (
<Container maxWidth="sm">
<Box sx={{ my: 4 }}>
<div className="my-4">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Box is not really relevant if you use Tailwind CSS

@@ -14,7 +14,7 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
"jsx": "react"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the export with Stackblitz and Codesandbox.

Co-authored-by: danilo leal <67129314+danilo-leal@users.noreply.github.com>
@oliviertassinari oliviertassinari merged commit 8e5ab0a into mui:master Feb 8, 2022
@oliviertassinari oliviertassinari deleted the tailwind-add-live-demo branch February 8, 2022 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants