Textarea
A Native <textarea />
for long text, comments, etc.
Preview & Playground 🖼️
Here you may find a preview of the component, with error & possible variants.
🏄 Click to expand the code
<script setup lang="ts">
import { Textarea as VanillaTextArea } from '@flavorly/vanilla-components'
import { ref } from 'vue'
const value = ref(null)
const valueDisabled = ref(null)
const valueErrors = ref(null)
</script>
<template>
<PreviewWrapper>
<div class="grid space-y-2">
<!-- Regular -->
<VanillaTextArea
v-model="value"
placeholder="You can write something long here"
feedback="You can add SVGs as addons before & After"
/>
<!-- Errors -->
<VanillaTextArea
v-model="valueErrors"
placeholder="You can also have a long story about Elon Musk memes on Twitter"
feedback="Im showing only because you cleared errors"
errors="We have a problem Musk, Abort! Write to clear"
/>
<!-- Disabled -->
<VanillaTextArea
v-model="valueDisabled"
:disabled="true"
placeholder="Hey! Im disabled and you should be able to touch me :p"
feedback="Im disabled and shouldnt be changed"
/>
</div>
</PreviewWrapper>
</template>
Props 📥
Props available for this component extending the default variant & global props.
Prop | Description | Accepted Values | Default |
---|---|---|---|
modelValue | The value for the element | Any | undefined |
rows | Number of rows for the textarea | Number | 4 |
copiable | If we can copy | boolean | false |
autosize | If height should adapt | boolean | false |
maxHeight | Maximum height | string | auto |
Slots 🧬
Current slots available for this component are the following:
Slot before
Slot to override or pre-pend to the component before the component, ex: icon, etc.
Attribute | Description | Type |
---|---|---|
className | Classes injected | String |
Slot after
Slot to override or append to the component before the component, ex: icon, etc.
Attributes specially injected to the after
slot for some inputs ( Ex: Password )
Attribute | Description | Type |
---|---|---|
hasErrors | If the field has errors | Boolean |
type | Type of input | String |
showingPassword | If the password showing is toggled | Boolean |
Slot errors
Slot that holds the error messages when the component errors
prop is defined.
Attribute | Description | Type |
---|---|---|
errors | The errors being injected | [String, Array] |
hasErrors | If the field has errors | Boolean |
Slot feedback
Slot that holds the feedback messages when the component feedback
prop is defined. When showing errors the feedback will be hidden by default, and vice-versa.
Attribute | Description | Type |
---|---|---|
errors | The errors being injected | [String, Array, Undefined] |
feedback | The feedback message | [String, Undefined] |
Events 🚇
Here you may find the events emitted by this component.
Event | Description | Value |
---|---|---|
update:modelValue | When the value changes | any |