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 Material You Button playground #35222

Merged
merged 18 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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>
)}
/>
);
}
10 changes: 10 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,13 @@ However:
```

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

## Material You version

This component also supports the new Material Design spec - [Material You](https://m3.material.io/). It is implemented in form of a new component in the experimental `@mui/material-next` package.
mnajdova marked this conversation as resolved.
Show resolved Hide resolved

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

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