Coder Social home page Coder Social logo

shyamlohar / ngx-autosize Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chrum/ngx-autosize

0.0 1.0 0.0 423 KB

Angular2+ textarea autosize directive

Home Page: https://chrum.it/pages/ngx-autosize/

License: MIT License

JavaScript 11.07% TypeScript 60.39% HTML 27.48% CSS 1.06%

ngx-autosize's Introduction

npm version License: MIT

ngx-autosize

ngx-autosize is an Angular2+ 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.

  • Production builds ready (AOT support)
  • Works with Ionic (shadow dom of v4 too)

Check the demo here

Installation:

npm install ngx-autosize

Use Example:

Add the declaration to your @NgModule:

import {AutosizeModule} from 'ngx-autosize';

...

@NgModule({
  imports: [
    AutosizeModule
  ]
})

Use directly inside your HTML templates

<textarea autosize class="my-textarea">
    Hello, this is an example of Autosize in Angular2.
</textarea>
<ion-textarea autosize [(ngModel)]="text">
    And this is Ionic2 example
</ion-textarea>

Settings

Name Default Type Description
minRows integer Sets minimal amount of rows of the textarea
maxRows integer Sets maximum rows count after which autosizing if turned off and scrollbar appears
onlyGrow false boolean Controls if autosize should make the textarea smaller. In other words... should empty lines be trimmed?
useImportant false boolean Controls 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">
    Hello, this is an example of Autosize in Angular2.
</textarea>

Origins

This small lib is based on great http://stevepapa.com/angular2-autosize which is unfortunatelly not maintained and abandoned :(

Authors

Steve Papa Chrystian Ruminowicz

Licence

This project is licensed under the MIT license. See the LICENSE file for more info.

ngx-autosize's People

Contributors

chrum avatar nurfgun avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.