-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement on Textarea.js to allow custom ROWS_HEIGHT value #11375
Comments
This value is only used for the initial rendering, we compute the line height for the following updates. |
Ok thanks for your reply. But one thing that I've noticed was that the font-size that I used in my component was 14px but if I use the same used in default component, which is 16px, I do not get that "empty" space. Is there anything that can be done to adjust the height according to the font-size? |
@kmestre Let me see a live example. Hard to tell without. |
@oliviertassinari here is the example https://codesandbox.io/s/z2rv8w948p |
I was having some issues with this, and solved it by setting line height in the root element and font size in the input element, like this:
|
@CorayThan What's wrong with that? import React from "react";
import PropTypes from "prop-types";
import { withStyles } from "@material-ui/core/styles";
import TextField from "@material-ui/core/TextField";
const styles = theme => ({
input: {
fontSize: 40
}
});
class TextFields extends React.Component {
state = {
multiline: "Controlled"
};
handleChange = name => event => {
this.setState({
[name]: event.target.value
});
};
render() {
const { classes } = this.props;
return (
<form className={classes.container} noValidate autoComplete="off">
<TextField
id="multiline-flexible"
multiline
rowsMax="4"
value={this.state.multiline}
onChange={this.handleChange("multiline")}
InputProps={{
className: classes.input
}}
margin="normal"
/>
</form>
);
}
}
TextFields.propTypes = {
classes: PropTypes.object.isRequired
};
export default withStyles(styles)(TextFields); |
Hello,
Currently in Textarea component the ROWS_HEIGHT is static, and it has 19 as value.
Can we make it updatable based on a new prop? This will be very useful when having smaller fonts and smaller line heights.
Please see below an example where I've a lot of "empty" space between the last text line and the underline:
I'll wait for your feedback.
Thanks!
The text was updated successfully, but these errors were encountered: