myriacl / vue-textarea-autosize

Vue component provides textarea with automatically adjustable height and without any wrappers and dependencies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vue-textarea-autosize

npm npm vue2

Vue component provides textarea with automatically adjustable height and without any wrappers and dependencies

Finctionality

  • v-model binding in parent
  • min/max height limitation
  • enable/disable auto resizing dynamically

Note

  • You are able to handle all native events via @eventname.native read more
  • There is no any CSS from box, so you are free to style it as you wish

Install

Install with npm

npm install vue-textarea-autosize --save

or with yarn

yarn add vue-textarea-autosize

Adding into app

In your main.js

import Vue from 'vue'
import VueTextareaAutosize from 'vue-textarea-autosize'

Vue.use(VueTextareaAutosize)

Usage

In components

<textarea-autosize
  placeholder="Type something here..."
  ref="someName"
  v-model="someValue"
  :min-height="30"
  :max-height="350"
  @blur.native="onBlurTextarea"
></textarea-autosize>

Focus/blur or select content in components

this.$refs.someName.$el.focus()
this.$refs.someName.$el.blur()
this.$refs.someName.$el.select()

Interface

Props

Props Required Type Default Description
autosize         false Boolean      true allow to enable/disable auto resizing dynamically
minHeight false Number null min textarea height
maxHeight false Number null max textarea height

Events

Name Params Description
input value fires on textarea content changed. part of a v-model binding. read more

Slots

There is no any slots available


License

MIT

About

Vue component provides textarea with automatically adjustable height and without any wrappers and dependencies

License:MIT License


Languages

Language:JavaScript 61.2%Language:Vue 38.8%