-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] Add Material You Button playground (#35222)
- Loading branch information
Showing
4 changed files
with
412 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
docs/data/material/components/buttons/ButtonMaterialYouPlayground.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
)} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.