HEX
Server: LiteSpeed
System: Linux s3604.bom1.stableserver.net 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User: dmstechonline (1480)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/dmstechonline/whatsapp.dmstech.online/resources/js/Components/FormTextArea.vue
<script setup>
    import { ref } from 'vue';

    const props = defineProps({
        modelValue: [String, Number],
        showLabel: {
            type: Boolean,
            default: true
        },
        name: String,
        type: String,
        className: String,
        placeholder: String,
        textAreaRows: Number,
        error: String,
    })

    const emit = defineEmits(['update:modelValue']);
    const updateValue = (event) => {
        emit('update:modelValue', event.target.value);
    };
</script>
<template>
    <div :class="className">
        <label v-if="showLabel" for="name" class="block text-sm leading-6 text-gray-900">{{ name }}</label>
        <div class="mt-2">
            <textarea 
                class="block w-full rounded-md border-0 py-1.5 px-4 text-gray-900 shadow-sm outline-none ring-1 ring-inset placeholder:text-gray-400 sm:text-sm sm:leading-6"
                :class="error ? 'ring-[#b91c1c]' : 'ring-gray-300'"
                :value="props.modelValue"
                @input="updateValue"
                :placeholder="placeholder"
                :rows="textAreaRows"
                >
                {{ props.modelValue }}
            </textarea>
        </div>
        <div v-if="error" class="form-error text-[#b91c1c] text-xs">{{ error }}</div>
    </div>
</template>