Rows and Columns in React TextArea Component

10 Mar 20253 minutes to read

Two Essential® attributes, rows and columns, play a pivotal role in customizing the TextArea’s appearance and layout.
The rowsattribute determines the initial visible number of lines within the TextArea, controlling its vertical size. Conversely, the columns attribute specifies the visible width of the TextArea in characters per line, determining its initial width.

  • You can customize the TextArea component by setting the number of rows using the rows property and the number of columns using the cols property. These properties allow precise control over the dimensions of the TextArea, ensuring it fits seamlessly within the layout of the application.
// Import the TextArea.
import { TextAreaComponent } from '@syncfusion/ej2-react-inputs';
import * as React from 'react';
import * as ReactDom from 'react-dom';

// To render TextArea.
function App() {
    return (
        <div className='wrap'>
            <div>
                <TextAreaComponent id="default1" placeholder="Enter your comments" floatLabelType="Auto" rows="3" cols="35"></TextAreaComponent>
            </div>
            <div>
                <TextAreaComponent id="default2" placeholder="Enter your comments" floatLabelType="Auto" rows="5" cols="40"></TextAreaComponent>
            </div>        
        </div>
    );
}
export default App;
ReactDom.render(<App />, document.getElementById('input-container'));
// Import the TextArea.
import { TextAreaComponent } from '@syncfusion/ej2-react-inputs';
import * as React from 'react';
import * as ReactDom from 'react-dom';

// To render TextArea.
function App() {
  
    return (
        <div className='wrap'>
            <div>
                <TextAreaComponent id="default1" placeholder="Enter your comments" floatLabelType="Auto" rows="3" cols="35"></TextAreaComponent>
            </div>
            <div>
                <TextAreaComponent id="default2" placeholder="Enter your comments" floatLabelType="Auto" rows="5" cols="40"></TextAreaComponent>
            </div>
        </div>
    );
}
export default App;
ReactDom.render(<App />,document.getElementById('input-container'));