Rows and Columns in Angular TextArea Component

15 Jun 20242 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 control 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 { 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';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));