import React, { Fragment, PureComponent } from 'react'; import PropTypes from 'prop-types'; import { withStyles, MuiThemeProvider, createMuiTheme } from '@material-ui/core/styles'; import { purple, green } from '@material-ui/core/colors'; import { Typography, Grid, Input, InputLabel, TextField, FormControl } from '@material-ui/core'; const styles = theme => ({ demo: { height: 'auto', }, divider: { display: 'block', margin: `${theme.spacing(3)}px 0`, lineHeight: '24px' }, input: { margin: theme.spacing(3), }, margin: { margin: theme.spacing(1), }, container: { display: 'flex', flexWrap: 'wrap', }, textField: { margin: `${theme.spacing(2)}px ${theme.spacing(1)}px`, width: 200, }, cssLabel: { '&$cssFocused': { color: purple[500], }, }, cssFocused: {}, cssUnderline: { '&:after': { backgroundColor: purple[500], }, }, bootstrapRoot: { padding: 0, 'label + &': { marginTop: theme.spacing(3), }, }, bootstrapInput: { borderRadius: 4, backgroundColor: theme.palette.common.white, border: '1px solid #ced4da', fontSize: 16, padding: '10px 12px', width: 'calc(100% - 24px)', transition: theme.transitions.create(['border-color', 'box-shadow']), '&:focus': { borderColor: '#80bdff', boxShadow: '0 0 0 0.2rem rgba(0,123,255,.25)', }, }, bootstrapFormLabel: { fontSize: 18, }, }); const theme = createMuiTheme({ palette: { primary: green, }, }); class TextFields extends PureComponent { render() { const { classes } = this.props; return ( Layout TextField, FormControl allow the specification of margin to alter the vertical spacing of inputs. Using none (default) will not apply margins to the FormControl, whereas dense and normal will as well as alter other styles to meet the specification.
Customized Designs Here is an example of how you can change the main color of an Input.
Custom CSS
); } } TextFields.propTypes = { classes: PropTypes.object.isRequired, }; export default withStyles(styles)(TextFields);