Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Material-UI text field with dynamic rows

I'm trying to have a multiline TextField component that takes all available space depending on a device.

textfield

I know fullWidth but is there a way to have something like fullHeight in rows setting, depending on a device that it is displayed on?


1 Answers

A solution is to manupulate Material-UI classes using JSS.

I change the height of the input base and align the text at start vertically.

const useStyles = makeStyles(() => ({
  input: {
    height: "100%",
    "& .MuiInputBase-root": {
      height: "100%",
      display: "flex",
      alignItems: "start"
    }
  }
}));

Add the input classes to your input and it's work.

All the exemple bellow on this codesandbox.

like image 188
Melvynx Avatar answered Mar 19 '26 10:03

Melvynx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!