1.0.0 • Published 8 years ago

vue-textarea v1.0.0

Weekly downloads
159
License
MIT
Repository
github
Last release
8 years ago

vue-textarea

a autoresizing textarea.

Demo

Install

npm install --save-dev vue-textarea

or include build/bundle.js.

Usage

# in your component
components:
  "vc-textarea": require("vue-textarea")
# or, when using bundle.js
components:
  "vc-textarea": window.vueComps.textarea
<vc-textarea>Content
  <span slot="placeholder">A placeholder</span>
</vc-textarea>

see dev/ for examples.

Props

Nametypedefaultdescription
valueStringtextContent of slot(two-way) content of the textarea
taclassVueClass[]class of the textarea
styleVueStyle[]style of the wrapper div
autofocusBooleanfalseautofocus
disabledBooleanfalsedisabled
readonlyBooleanfalsereadonly
no-extra-lineBooleanfalsedoesn't add the extra empty line on resize
sizeObject{height:offsetHeight,width:offsetWidth}size of the closed textarea
max-sizeObject{height:Number.MAX_VALUE,width:this.size.width}size of the opened textarea
hover-sizeObject{height:this.size.height,width:this.size.width}size of the closed textarea on hover
is-openedBooleanfalse(two-way) set to open / close (will open on focus and close on blur)
transition-inFunctionno animationanimation for increasing size. Argument: {el,style,cb}
transition-outFunctionno animationanimation for reducing size. Argument: {el,style,cb}

Events

focus, blur, keyup will pass-through

Namedescription
before-enterwill be called before open animation
after-enterwill be called when opened
before-leavewill be called before close animation
after-leavewill be called when closed
inputwill be emitted when value changed

Changelog

  • 1.0.0
    events are renamed after vue transitions
    added unit tests
    bugfixes

Development

Clone repository.

npm install
npm run dev

Browse to http://localhost:8080/.

License

Copyright (c) 2016 Paul Pflugradt Licensed under the MIT license.