vue-auto-resize

A Vue directive to auto resize the height of a textarea to its contents as you type.
2,490 7
Install
npm install vue-auto-resize
Latest Version:1.0.1
License:MIT
Last Updated:Jul 19, 2020
Links: GitHub  ·  npm
Maintainer: yiddishe-kop

Vue Auto Resize Directive

A simple directive to make your textareas height automatically grow as the user types some text.

Try it out live on https://pninim.yiddishe-kop.com.

demo

Installation

Install via NPM:

npm i vue-auto-resize

Usage

Globaly

To have the directive available inyour whole project, import it in your main entypoint:

import Vue from 'vue'
import AutoSize from 'vue-auto-resize'

Vue.directive('auto-resize', AutoSize)

Then you can use the directive on any textarea like so:

<template>
  <div>
    <textarea v-auto-resize></textarea>
  </div>
</template>

Locally

If you only want to make available in one component, you can import it locally:

<template>
  <div>
    <textarea v-auto-resize></textarea>
  </div>
</template>

<script>
  import AutoSize from 'vue-auto-resize'
  export default {
    directives: {
        'auto-resize': AutoSize
     }
  };
</script>

The whole thing is only 348 bytes before minification! 😎💡

License

MIT

Related Packages

vue-lazysizes

If you use Lazysizes this vue-directive updates img element if src attribute is...

11,786
vue-lazyload

Vue module for lazy-loading images in your vue.js applications.

2,917,864 7,978
vue-lazyload-token

Vue module for lazy-loading images in your vue.js applications.

1,089 7,977
v-resize

resize directive for Vue 2.0

894 5
vue-lazyload-ssr

Vue module for lazy-loading images in your vue.js applications.(support ssr)

853 1

Version History

Version Released License
1.0.1 MIT
1.0.0 MIT