Adapt Material UI components based on props with styled-components
Veröffentlicht am: 15. März 2020
Lesedauer: 1 Min.
- import Modules
import styled from 'styled-components' import { Button } from '@material-ui/core'
- Create a custom Component
const MyButton = styled(({ props, ...other }) => <Button {...other} />)({
background: props => props.bg,
color: 'white',
'&:hover': {
backgroundColor: props => props.bgHover,
},
})
<MyButton>click me</MyButton>
Articles in related Categories
18. März 2020
18. März 2020
04. März 2020
18. März 2020