You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP

resize-textarea-vue3

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resize-textarea-vue3

**A simple resize textarea for Vue3.**

1.1.4
latest
Version published
Weekly downloads
440
-34.33%
Maintainers
0
Weekly downloads
 
Created

Resize Textarea

A simple resize textarea for Vue3.

Inspired from vue-textarea-autosize (Works with Vue2)

Installation

Install the package using npm

npm i resize-textarea-vue3

Documentation

  • Create a new Vue instance
  • Import ResizeTextarea and use it
import { createApp } from 'vue'
import ResizeTextarea from 'resize-textarea-vue3'

const app = createApp({
  /* root component options */
})
app.use(ResizeTextarea)
.mount('#app')

Available props:

Propsrequiredtypedefault
placeholdernoStringNull
rowsnoNumber2
colsnoNumber0
minHeightnoNumber50 px
maxHeight (The content will be scrollable after set limit)noNumberNull
modelValuenoString / NumberNull
autoResize (The drag handle is disabled by default.)noBoooleantrue

The default unit is (px)

Component simple usage example:

<template>
    <div id="wrapper">
        <resize-textarea
        :placeholder="placeholder"
        :rows="2"
        :cols="4"
        :maxHeight="150"
        v-model="textValue">
        </resize-textarea>
    </div>
    <script>
    export default {
        data() {
            return {
                placeholder: "This is a test message",
                textValue: "reSize",
            }
        },
    }
    </script>
</template>

Component usage with update:modelValue event example:

<template>
    <div id="wrapper">
        <resize-textarea
        :placeholder="placeholder"
        :modelValue="textValue"
        @update:modelValue="(value)=>useUpdatedValue(value)"
        v-model="textValue">
        </resize-textarea>
    </div>
    <script>
    export default {
        data() {
            return {
                placeholder: "This is a test message",
                textValue: "reSize",
            }
        },
        methods: {
            useUpdatedValue(value) {
                //do something 
            }
        }
    }
    </script>
</template>

Component usage example with state management:

<template>
    <div id="wrapper">
        <resize-textarea
        :placeholder="placeholder"
        v-model="textValue">
        </resize-textarea>
    </div>
    <script>
    export default {
        data() {
            return {
                placeholder: "This is a test message",
            }
        },
        computed: {
            textValue: {
                get() {
                    return this.$store.state.textValue
                },
                set(v) {
                    this.$store.commit('UPDATE', v)
                }
            }
        }
    }
    </script>
</template>

FAQs

Package last updated on 18 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts