I’m working on a Material UI form where the input box (Text Field) is 200px wide on load.
I want to make the input box expand to 100% width only when the box is selected or clicked on.
...
<FormGroup sx={{ maxWidth: "200px" }}>
<FormControl>
<TextField
id="first_name"
label="First name" />
</FormControl>
</FormGroup>
...
I’m looking to doing something like How to stretch input field to full width? but with Material UI.
I’ve tried using an onClick
attribute on TextField
but that did not action register an event on click.
I know there’s a fullWidth
attribute for TextField
but I’m just not sure how to go about changing the attribute on click.