GithubHelp home page GithubHelp logo

jayeshbhalodia / angularjs-autogrow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from evyros/angularjs-autogrow

0.0 2.0 0.0 16 KB

AngularJS 1.x directive for auto-grow / auto-resize of textarea elements.

HTML 100.00%

angularjs-autogrow's Introduction

angularjs-autogrow

AngularJS directive for auto-grow / auto-resize of textarea elements on typing.

  • Works in all cases: expands on line breaks and word breaks.
  • Great Performance: minimal DOM manipulation and no watchers.
  • Allows limitation of auto-growing so a scrollbar will appear after X lines of content.

Installation via NPM

npm install angularjs-autogrow --save

Usage:

Include angular-autogrow.min.js file in <head> section of the HTML:

<script type="text/javascript" src="angularjs-autogrow.min.js"></script>

Include angularjs-autogrow dependency in your angular module:

var app = angular.module("app", ["angularjs-autogrow"]);

It's also recommended to add those two CSS properties to make things stable:

textarea {
	resize: none;
	box-sizing: content-box;
}

Add the directive to the textarea element:

<textarea autogrow></textarea>

More Options:

Limit Autogrow Lines

You can limit the auto-growing of the textarea element by using max-lines attribute:

<textarea autogrow max-lines="3"></textarea>

Set Initial Rows

You can set the initial line number using rows attribute:

<textarea autogrow rows="1"></textarea>

Autogrow on css properties change

You can define which CSS properties have to be watched in order to trigger the auto-growing:

<textarea autogrow="font-family,font-size"></textarea>

angularjs-autogrow's People

Contributors

codingaspect avatar evyros avatar

Watchers

 avatar  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.