Skip to content

Textarea Component

Textarea Component

Textarea component for multi-line text input, supporting adaptive height, character limit, line break control, and other features.

Basic Usage

Basic textarea usage, bind the textarea value through v-model.

Current value:
Show CodeArrow
CopyGitHub

Disabled State

Add the disabled attribute to disable the textarea.

Show CodeArrow
CopyGitHub

Resize Control

Textarea can be resized by default. Use the isResize attribute to control whether resizing is allowed.

Resizable (default):
Disable resize:
Show CodeArrow
CopyGitHub

Line Break Control

Textarea allows line breaks by default. Use the isEnter attribute to control whether line breaks are allowed.

Allow line breaks (default):
Current value:
Disable line breaks:
Current value:
Show CodeArrow
CopyGitHub

Character Limit

Set the maxLength attribute to limit the maximum input length of the textarea. By default, it shows the current cursor line number and character count. Use the isCursor attribute to control whether to show cursor line number.

Show cursor position (default):
Hide cursor position:
Current length: 0/50
Show CodeArrow
CopyGitHub

Debounced Input

Set the debounce attribute to implement debounced input, delaying the trigger of input events.

Real-time value:
Debounced value (1 second delay):
Show CodeArrow
CopyGitHub

Different Sizes

Textarea supports three sizes: small, default, and large.

Small size:
Default size:
Large size:
Show CodeArrow
CopyGitHub

Event Handling

Textarea provides multiple events: focus, blur, enter, input.

Event Log:
Show CodeArrow
CopyGitHub

Textarea API

Attributes

AttributeDescriptionTypeAccepted ValuesDefault
v-modelBinding valuestring
sizeSizestringsmall / default / largedefault
placeholderPlaceholder textstring
disabledWhether disabledbooleanfalse
maxLengthMaximum input lengthnumber
isCursorWhether show current cursor line numberbooleantrue
isResizeWhether allow resizingbooleantrue
isEnterWhether allow line break inputbooleantrue
isTipWhether show tip textbooleantrue
tipCustom tip textstring
tipClassTip text class namestring
debounceDebounce event callback(data?: string) => void
debounceDelayDebounce delay time (ms)number1000

Events

Event NameDescriptionParameters
focusTriggered when gaining focus(value: string)
blurTriggered when losing focus(value: string)
inputTriggered when input value changes(value: string)
enterTriggered when Enter key is pressed(value: string)
clearTriggered when clear button is clicked

Style Variables

The textarea component uses the following style variables, which can be customized through SCSS variables:

Variable NameDescription
$theme-color-primaryTheme color - Primary
$border-color-defaultBorder color - Default
$font-size-defaultFont size - Default

Released under the MIT License