material ui react button code example

Example 1: material-ui button

// Check out my online sandbox to see more button props
// https://codesandbox.io/s/material-ui-button-e809z?file=/src/App.js

import React from 'react';
import Button from '@material-ui/core/Button';

export default function MaterialuiButton() {
  
  function handleButtonPress() {
    console.log("button pressed");
  }
  
  return (
    <Button
    variant='contained'
    color='primary'
    onClick={() => {
        handleButtonPress();
    }}
    >
      PRESS ME
    </Button>
  );
}

Example 2: button material ui

<Button variant="contained">Default</Button>
<Button variant="contained" color="primary">
  Primary
</Button>
<Button variant="contained" color="secondary">
  Secondary
</Button>
<Button variant="contained" disabled>
  Disabled
</Button>
<Button variant="contained" color="primary" href="#contained-buttons">
  Link
</Button>