React-bootstrap: rows not respected for textarea form element

Created on 3 Oct 2016  路  3Comments  路  Source: react-bootstrap/react-bootstrap

The following textarea component ignores the 'rows' attribute. Using the default bootstrap code works.
<textarea class="form-control" rows="6"></textarea>

          <Form horizontal>
                <FormGroup controlId="formHorizontalEmail">
                    <Col componentClass={ControlLabel} sm={2}>
                        PDB Code
                    </Col>
                    <Col sm={10}>
                        <FormControl type="text" placeholder="PDB Code" maxLength={4} cols={4}/>
                    </Col>
                </FormGroup>

                <FormGroup controlId="formHorizontalPassword">
                    <Col componentClass={ControlLabel} sm={2}>
                        Description
                    </Col>
                    <Col sm={10}>
                        <FormControl type="textarea" rows={6} maxLength={4000} placeholder="Description"/>
                    </Col>
                </FormGroup>

                <FormGroup>
                    <Col smOffset={2} sm={10}>
                        <Button type="submit">
                            Submit
                        </Button>
                    </Col>
                </FormGroup>
            </Form>

Most helpful comment

Did you figure out how to get rows to be set in a react form textarea?

All 3 comments

  1. It's componentClass="textarea", not type="textarea"
  2. In React, you set the CSS class with className, not class
  3. You can see trivially that if you actually set up the Bootstrap textarea.form-control directly, that Bootstrap by default styles it with 100% width anyway

Did you figure out how to get rows to be set in a react form textarea?

<Form.Control as="textarea" rows={10}/>

Like this it works. You can set whatever number in rows.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lailo picture lailo  路  3Comments

patsissons picture patsissons  路  3Comments

jquense picture jquense  路  3Comments

Shadowman4205 picture Shadowman4205  路  3Comments

Vivekbhusal picture Vivekbhusal  路  3Comments