Shards Vue

Documentation

    Form Textarea

    The <d-form-textarea> component allows you to create multi-line text inputs that adjusts its height (text rows) automatically to fit the content. You can also limit the number of rows displayed using the max-rows prop. If you'd like to force the textarea element to a fixed height, you can use both rows and max-rows props simultaneously.

    Alias

    The <d-form-textarea> component is also available as <d-textarea>.

    Basic Example

    <template>
        <div>
            <d-form-textarea v-model="text"
                            placeholder="Enter something"
                            :rows="3"
                            :max-rows="6">
            </d-form-textarea>
            <span v-if="text" class="d-block my-2">🤔 So you're saying: {{ text }}</span>
        </div>
    </template>
    
    <script>
    export default {
        data () {
            return {
                text: ''
            }
        }
    }
    </script>
    
    <!-- textarea-1.vue -->
    

    Validation

    Using the state prop on the <d-form-textarea> component you can control the textarea's validation state.

    The following textarea states are available:

    • invalid when the textarea is invalid.
    • valid when the use textarea is valid.
    • null when the textarea should display no validation state (neutral).
    <template>
        <div>
            <d-form-textarea state="valid"
                            v-model="text"
                            placeholder="You can start your novel right here..."
                            :rows="3"
                            :max-rows="6">
            </d-form-textarea>
            <span v-if="text" class="d-block my-2">🤔 So you're saying: {{ text }}</span>
        </div>
    </template>
    
    <script>
    export default {
        data () {
            return {
                text: ''
            }
        }
    }
    </script>
    
    <!-- textarea-2.vue -->
    

    Props

    PropDescriptionTypeDefaultRequired
    :nameThe element name.StringnullFalse
    :idThe element ID.StringnullFalse
    :disabledThe disabled state.BooleanFalse
    :requiredThe required state.BooleanFalse
    :stateThe validity state.Boolean | StringnullFalse
    :sizeThe element's size.StringnullFalse
    :placeholderThe placeholder value.StringnullFalse
    :autocompleteThe autocomplete status.StringnullFalse
    :readonlyWhether the textarea should be read-only, or not.BooleanfalseFalse
    :plaintextWhether the textarea should be plain-text, or not.BooleanfalseFalse
    :rowsThe number of text rows.Number | StringnullFalse
    :wrapThe textarea wrap style.String"soft"False
    :no-resizeWhether resizing should be disabled, or not.BooleanfalseFalse