using material ui with react code example

Example 1: how to use material ui in html

<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>

Example 2: material ui

$ npm install @material-ui/core

Example 3: react js material ui

//install in the terminal
$ npm install @material-ui/core

// use the CDN 
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />

//on the component
import { Button } from '@material-ui/core';

function App() {
  return <Button color="primary">Hello World</Button>;
}

Example 4: material ui

import TextField from '@material-ui/core/TextField'

<TextField
                id="slots" 
                type="number"
                min={1}
                defaultValue="1"
                className="TextField pa2" 
                onChange={handleChange} 
                label="number of slots" 
                InputProps={{ 
                    inputProps: { min: 1} 
                 }}
                InputLabelProps = {{
                    shrink:true,
                }}/>

Tags:

Misc Example