Rows and Columns in Angular TextArea
25 Sep 20262 minutes to read
The rows and columns attributes play a crucial role in customizing the Angular TextArea’s appearance and layout. The rows attribute determines the initial visible number of lines within the Angular TextArea, controlling its vertical size. The cols attribute specifies the visible width of the Angular TextArea in characters per line, determining its horizontal size.
Customize the Angular TextArea dimensions by setting the number of rows using the rows property and the number of columns using the cols property. These properties provide precise control over the textarea dimensions, ensuring it fits seamlessly within your application’s layout.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import {TextAreaModule} from '@syncfusion/ej2-angular-inputs'
import { Component } from '@angular/core';
@Component({
imports: [
TextAreaModule
],
standalone: true,
selector: 'app-root',
template: `<div class="wrap">
<div class='textarea'>
<div>
<ejs-textarea id="default1" placeholder="Enter your comments" floatLabelType="Auto" rows="3" cols="35"></ejs-textarea>
</div>
<div>
<ejs-textarea id="default2" placeholder="Enter your comments" floatLabelType="Auto" rows="5" cols="40"></ejs-textarea>
</div>
</div>
</div>`
})
export class AppComponent { }import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
bootstrapApplication(AppComponent).catch((err) => console.error(err));