Your task is to:
- Conceal the label (I'm currently doing it when a value is entered just for demonstration - feel free to remove it completely)
- Finalize the border, meaning remove the legend using CSS
Applicable CSS:
legend { border: 1px solid red; display: none; }
Relevant JavaScript:
const styles = theme => ({
cssLabel: {
color: "green"
},
cssLabelHide: {
display: "none"
},
});
<TextField
id="standard-name"
label="Name"
className={classes.textField}
value={this.state.name}
onChange={this.handleChange("name")}
margin="normal"
variant="outlined"
InputLabelProps={{
classes: {
root:
this.state.labelVisibility === true
? classes.cssLabel
: classes.cssLabelHide,
focused: classes.cssFocused
}
}}
InputProps={{
classes: {
root: classes.cssOutlinedInput,
focused: classes.cssFocused,
notchedOutline: classes.notchedOutline
},
inputMode: "numeric"
}}
/>
Check out a functional example on StackBlitz here