Skip to content

Commit 6a1f432

Browse files
mnajdovafeliperli
authored andcommitted
[docs] Add Material You Button playground (mui#35222)
1 parent 2c67150 commit 6a1f432

File tree

4 files changed

+412
-0
lines changed

4 files changed

+412
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import * as React from 'react';
2+
import MaterialYouUsageDemo from 'docs/src/modules/components/MaterialYouUsageDemo';
3+
import Box from '@mui/material/Box';
4+
import Button from '@mui/material-next/Button';
5+
import FavoriteBorder from '@mui/icons-material/FavoriteBorder';
6+
7+
export default function ButtonUsage() {
8+
const [variant, setVariant] = React.useState('text');
9+
return (
10+
<MaterialYouUsageDemo
11+
componentName="Button"
12+
data={[
13+
{
14+
propName: 'variant',
15+
knob: 'select',
16+
defaultValue: 'text',
17+
options: ['text', 'outlined', 'filled', 'filledTonal', 'elevated'],
18+
onChange: (e) => setVariant(e.target.value),
19+
},
20+
...(variant === 'filled' || variant === 'text' || variant === 'outlined'
21+
? [
22+
{
23+
propName: 'color',
24+
knob: 'select',
25+
defaultValue: 'primary',
26+
options: ['primary', 'secondary', 'tertiary'],
27+
},
28+
]
29+
: []),
30+
{
31+
propName: 'size',
32+
knob: 'select',
33+
options: ['small', 'medium', 'large'],
34+
defaultValue: 'medium',
35+
},
36+
{
37+
propName: 'disabled',
38+
knob: 'switch',
39+
defaultValue: false,
40+
},
41+
]}
42+
renderDemo={(props) => (
43+
<Box sx={{ display: 'flex', gap: 2 }}>
44+
<Button {...props}>Hello world</Button>
45+
<Button {...props} startIcon={<FavoriteBorder />}>
46+
Hello world
47+
</Button>
48+
</Box>
49+
)}
50+
/>
51+
);
52+
}

docs/data/material/components/buttons/buttons.md

+11
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,14 @@ However:
181181
```
182182

183183
This has the advantage of supporting any element, for instance, a link `<a>` element.
184+
185+
## Material You version
186+
187+
The default Button component follows the Material Design 2 specs.
188+
For the MD3 ([Material You](https://m3.material.io/)) version, install and import from the experimental `@mui/material-next` package:
189+
190+
```js
191+
import Button from '@mui/material-next/Button';
192+
```
193+
194+
{{"demo": "ButtonMaterialYouPlayground.js", "hideToolbar": true}}

0 commit comments

Comments
 (0)