import React, { Fragment, PureComponent } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { withStyles, MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles'; import AddIcon from '@material-ui/icons/Add'; import FileUpload from '@material-ui/icons/CloudUpload'; import { Link } from 'react-router-dom'; import { purple, green } from '@material-ui/core/colors'; import { Typography, Grid, Button, Fab, IconButton } from '@material-ui/core'; const styles = theme => ({ demo: { height: 'auto', }, divider: { margin: `${theme.spacing(3)}px 0`, }, field: { margin: `${theme.spacing(3)}px 0`, }, button: { margin: theme.spacing(1), }, container: { display: 'flex', flexWrap: 'wrap', }, margin: { margin: theme.spacing(1), }, cssRoot: { color: theme.palette.getContrastText(purple[500]), backgroundColor: purple[500], '&:hover': { backgroundColor: purple[700], }, }, bootstrapRoot: { boxShadow: 'none', textTransform: 'none', borderRadius: 4, fontSize: 16, padding: '6px 12px', border: '1px solid', backgroundColor: '#007bff', borderColor: '#007bff', '&:hover': { backgroundColor: '#0069d9', borderColor: '#0062cc', }, '&:active': { boxShadow: 'none', backgroundColor: '#0062cc', borderColor: '#005cbf', }, '&:focus': { boxShadow: '0 0 0 0.2rem rgba(0,123,255,.5)', }, }, gradientBtn: { background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)', borderRadius: 3, border: 0, color: 'white', height: 48, padding: '0 30px', boxShadow: '0 3px 5px 2px rgba(255, 105, 135, .30)', }, label: { textTransform: 'capitalize', }, inputUpload: { display: 'none', }, }); const theme = createMuiTheme({ palette: { primary: green, }, }); const LinkBtn = React.forwardRef(function LinkBtn(props, ref) { // eslint-disable-line return ; // eslint-disable-line }); class CustomButtons extends PureComponent { render() { const { classes } = this.props; const MyLink = React.forwardRef((props, ref) => ); // eslint-disable-line return ( Sizes Fancy larger or smaller buttons? Use the size or the mini property.
Style Here is an example of how you can change the main color of a Button.
Linked Button One common use case is to use the button to trigger a navigation to a new page.
Upload Button This a sample to trigger input files from button
); } } CustomButtons.propTypes = { classes: PropTypes.object.isRequired, }; export default withStyles(styles)(CustomButtons);