I tried to add a text between the two textfield but somehow the text is not properly aligned with the two textfield
JavaScript
x
28
28
1
import React from 'react';
2
import { makeStyles } from '@material-ui/core/styles';
3
import TextField from '@material-ui/core/TextField';
4
import Typography from '@material-ui/core/Typography';
5
6
const useStyles = makeStyles((theme) => ({
7
root: {
8
'& > *': {
9
margin: theme.spacing(1),
10
width: '12ch',
11
},
12
display:"row"
13
},
14
}));
15
16
export default function BasicTextFields() {
17
const classes = useStyles();
18
19
return (
20
<form className={classes.root} noValidate autoComplete="off">
21
<TextField id="standard-basic" label="Standard" />
22
<font size="6">feet</font>
23
<TextField id="outlined-basic" label="Outlined" variant="outlined" />
24
<font size="">inches</font>
25
</form>
26
);
27
}
28
Reference: https://codesandbox.io/s/m43tj?file=/demo.js:0-719
Advertisement
Answer
In this root class, which is your form’s container, add the following style:
JavaScript
1
3
1
display: 'flex',
2
alignItems: 'center',
3
Hope this helped =)