v-autosize
v2.0.1
Published
Lightweight Vue wrapper for `autosize`
Downloads
10,013
Maintainers
Readme
v-autosize
Lightweight Vue 3 wrapper for autosize.
Use v-autosize
directive on the textarea
element to make it automatically adjust height to fit text.
Using Vue 2?
Check old version v-autosize@1
Install
npm install v-autosize
Register
Register directive locally in the component
import autosize from 'v-autosize';
// Your component
export default {
directives: {
autosize,
}
}
Or register directive globally in the root Vue instance
import { createApp } from 'vue'
import autosizePlugin from 'v-autosize/src/plugin.js';
const app = createApp({})
app.use(autosizePlugin)
Use
Use v-autosize
directive on the textarea
element
<textarea v-autosize></textarea>
Comparison
- This module:
vue-autosize
: Doesn't support Vue 3,autosize-input
included, not maintained.vue-textarea-autosize
: Doesn't support Vue 3. A component is used instead of a directive.
License
MIT License