A light (2.2kB) and dependency-free replacement for built-in <textarea> and <input> elements allowing them to automatically stretch to fit the content.
npm install vue-autosizeryarn add vue-autosizerYou can import and register the plugin in the entry point of your application like so:
import VueAutosizer from 'vue-autosizer'
import 'vue-autosizer/dist/vue-autosizer.min.css'
Vue.use(VueAutosizer)Then use it like any other component:
// Input that grows in width
<autosize-input v-model="" />
// Textarea that grows in height
<autosize-textarea v-model="" /><template>
<autosize-input v-model="" />
<autosize-textarea v-model="" />
</template>
<script>
import { AutosizeInput, AutosizeTextarea } from 'vue-autosizer'
export default {
components: { AutosizeInput, AutosizeTextarea }
}
</script>
<style src="vue-autosizer/dist/vue-autosizer.min.css"/>If you have any reasonable PR you are welcome.