Skip to content

Commit

Permalink
[docs] Add Material You Button playground (mui#35222)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova authored and felipe.richter committed Dec 6, 2022
1 parent 2c67150 commit 6a1f432
Show file tree
Hide file tree
Showing 4 changed files with 412 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import * as React from 'react';
import MaterialYouUsageDemo from 'docs/src/modules/components/MaterialYouUsageDemo';
import Box from '@mui/material/Box';
import Button from '@mui/material-next/Button';
import FavoriteBorder from '@mui/icons-material/FavoriteBorder';

export default function ButtonUsage() {
const [variant, setVariant] = React.useState('text');
return (
<MaterialYouUsageDemo
componentName="Button"
data={[
{
propName: 'variant',
knob: 'select',
defaultValue: 'text',
options: ['text', 'outlined', 'filled', 'filledTonal', 'elevated'],
onChange: (e) => setVariant(e.target.value),
},
...(variant === 'filled' || variant === 'text' || variant === 'outlined'
? [
{
propName: 'color',
knob: 'select',
defaultValue: 'primary',
options: ['primary', 'secondary', 'tertiary'],
},
]
: []),
{
propName: 'size',
knob: 'select',
options: ['small', 'medium', 'large'],
defaultValue: 'medium',
},
{
propName: 'disabled',
knob: 'switch',
defaultValue: false,
},
]}
renderDemo={(props) => (
<Box sx={{ display: 'flex', gap: 2 }}>
<Button {...props}>Hello world</Button>
<Button {...props} startIcon={<FavoriteBorder />}>
Hello world
</Button>
</Box>
)}
/>
);
}
11 changes: 11 additions & 0 deletions docs/data/material/components/buttons/buttons.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,14 @@ However:
```

This has the advantage of supporting any element, for instance, a link `<a>` element.

## Material You version

The default Button component follows the Material Design 2 specs.
For the MD3 ([Material You](https://m3.material.io/)) version, install and import from the experimental `@mui/material-next` package:

```js
import Button from '@mui/material-next/Button';
```

{{"demo": "ButtonMaterialYouPlayground.js", "hideToolbar": true}}

0 comments on commit 6a1f432

Please sign in to comment.