1.8.1-next • Published 4 years ago

ngx-autosize-app v1.8.1-next

Weekly downloads
10
License
-
Repository
github
Last release
4 years ago

@techiediaries/ngx-autosize

ngx-autosize is an Angular 10 directive that automatically adjusts textarea height to fit its content.

It adjusts the textarea height automatically to any text input, or changes to the model bound to the textarea.

How to Install?

$ npm install @techiediaries/ngx-autosize

How to Use?

First import the module as follow:

import {AutosizeModule} from '@techiediaries/ngx-autosize';

...

@NgModule({
  imports: [
    AutosizeModule
  ]
})

Use directly inside your HTML templates

<textarea autosize>
    Angular 10 example
</textarea>

Settings

NameDefaultTypeDescription
minRowsintegerSets minimal amount of rows of the textarea
maxRowsintegerSets maximum rows count after which autosizing if turned off and scrollbar appears
onlyGrowfalsebooleanControls if autosize should make the textarea smaller. In other words... should empty lines be trimmed?
useImportantfalsebooleanControls if autosize should include !important in its height css styles. Should only need to be used if the height of the textarea is being overridden elsewhere
Example

<textarea autosize minRows="5" maxRows="10" (resized)="onResized($event)"> You need to implement 'onResized' yourself

## Credits

This library is based
[http://stevepapa.com/angular2-autosize](http://stevepapa.com/angular2-autosize)
and [ngx-autosize](https://www.npmjs.com/package/ngx-autosize)