Skip to content

Instantly share code, notes, and snippets.

@EduardoSaverin
Created July 8, 2018 09:32
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save EduardoSaverin/04d7d9529dfaf8cc9a404bb458bb8dbb to your computer and use it in GitHub Desktop.
Save EduardoSaverin/04d7d9529dfaf8cc9a404bb458bb8dbb to your computer and use it in GitHub Desktop.
Material UI React Login Form
import React from 'react';
import { Paper, withStyles, Grid, TextField, Button, FormControlLabel, Checkbox } from '@material-ui/core';
import { Face, Fingerprint } from '@material-ui/icons'
const styles = theme => ({
margin: {
margin: theme.spacing.unit * 2,
},
padding: {
padding: theme.spacing.unit
}
});
class LoginTab extends React.Component {
render() {
const { classes } = this.props;
return (
<Paper className={classes.padding}>
<div className={classes.margin}>
<Grid container spacing={8} alignItems="flex-end">
<Grid item>
<Face />
</Grid>
<Grid item md={true} sm={true} xs={true}>
<TextField id="username" label="Username" type="email" fullWidth autoFocus required />
</Grid>
</Grid>
<Grid container spacing={8} alignItems="flex-end">
<Grid item>
<Fingerprint />
</Grid>
<Grid item md={true} sm={true} xs={true}>
<TextField id="username" label="Password" type="password" fullWidth required />
</Grid>
</Grid>
<Grid container alignItems="center" justify="space-between">
<Grid item>
<FormControlLabel control={
<Checkbox
color="primary"
/>
} label="Remember me" />
</Grid>
<Grid item>
<Button disableFocusRipple disableRipple style={{ textTransform: "none" }} variant="text" color="primary">Forgot password ?</Button>
</Grid>
</Grid>
<Grid container justify="center" style={{ marginTop: '10px' }}>
<Button variant="outlined" color="primary" style={{ textTransform: "none" }}>Login</Button>
</Grid>
</div>
</Paper>
);
}
}
export default withStyles(styles)(LoginTab);
@talentedaamer
Copy link

id for password input should be id="password"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment