Textarea (文本域)

多行输入(v-model),支持自动增高、调整大小与字数统计。

基础用法

A short description about yourself.

Basic.vue

自动增高与字数

0/200
AutoGrow.vue

状态与尺寸

Please enter a message.

States.vue

颜色

Colors.vue

属性

属性类型默认值说明
autofocusbooleanfalseFocus the field on mount. Focus is moved with `preventScroll`, so it never jogs the page: an autofocused input inside a popover is at the document origin until Floating UI has positioned it, and letting the browser scroll to it there threw the page to the top.
autoGrowbooleanfalseGrow the field with its content up to `maxHeight`, instead of scrolling at a fixed `rows`.
colorKunUIColor"default"Focus-ring accent (the resting border/text stay neutral). Default 'default'.
darkBorderbooleantrueLegacy dark-mode border toggle.
descriptionstring""Helper text below the field (hidden when `error` is set). Canonical name.
disabledbooleanfalseBlocks input and dims the field.
errorstring""Error message below the field. Setting it also paints the invalid state and hides `description`.
hintstring""Helper text below the field.
labelstring""Visible label above the field, tied to it by `id` so a click focuses the textarea.
maxHeightstring""Ceiling for `autoGrow`, any CSS length (e.g. `"12rem"`). The field scrolls internally past it instead of growing forever.
maxlengthnumber100007Native maximum length. Also the denominator of `showCharCount`.
minlengthnumber1Native minimum length, enforced by form validation.
modelValuestring""The textarea's text, two-way bound with `v-model`.
namestring""Native form field name, for an uncontrolled `<form>` submit.
placeholderstring""Placeholder text. It is not a label — pair it with `label` or `ariaLabel`.
readonlybooleanfalseValue is selectable and copyable but not editable — unlike `disabled`, it stays focusable and is still submitted.
requiredbooleanfalseMarks the field required for native validation and assistive tech.
resize"none" | "horizontal" | "vertical" | "both""none"Which way the user may drag the native resize handle.
roundedKunUIRoundedCorner radius. Unset follows the app-wide config (default `md`).
rowsnumber4Initial visible rows — the field's height before `autoGrow` takes over.
showCharCountbooleanfalseShow a live `used / maxlength` counter under the field. Needs `maxlength` to show the denominator.
sizeKunUISize"md"Height, padding and font size, on the shared form-control scale.

事件

事件回调参数
blurevent: FocusEvent
focusevent: FocusEvent
inputevent: Event
update:modelValuevalue: string