Component

Textarea

安装 Installation

npx timkit add textarea --yes --framework react

用法 Usage

import { Textarea } from "@/components/ui/textarea"

className 与 variant、size 可以一起用。字段以 timkit agent inspect textarea --json 的 props 为准。

示例

Examples

一次看一个示例。左侧按名称筛选,预览里可切换源码和框架。

19 / 19

Textarea · Simple textarea

Loading preview...

结构化 API

Structured API

与 UCS schema 对齐的 props、逻辑机与多框架运行时。

Component

textarea

Logic

none

Runtime Frameworks

ReactVueWeappHTML

Supported Platforms

WebWeChat Mini Program

Configuration

PropTypeDefaultDescription
logic.provider*
enum (zag | native | none)
noneState and interaction provider used by this component.
logic.machine
string
-Underlying state machine identifier when provider is zag.
platforms*
array
Web, WeChat Mini ProgramPlatforms officially supported by this schema.
frameworks*
array
React, Vue, Weapp, HTMLFramework demos/code currently available in registry files.
dependencies
array
@timui/coreRuntime package dependencies required by this registry item.
optionalPeerDependencies
array
-Optional peer dependencies used by this registry item.
registryDependencies
array
-Dependent Timkit registry components/hook entries.

Props

PropTypeDefaultDescription
value
string
-The controlled value.
placeholder
string
-The placeholder text.
readOnly
boolean
falseWhen true, value changes are ignored.
disabled
boolean
falseWhether the textarea is disabled.
required
boolean
falseWhen true, the field is announced as required.
maxLength
number
-Typed text longer than this length is cut. An omitted length does not cut the text.

Events

PropTypeDefaultDescription
onValueChange
event
-Callback called when value changes.

TypeScript

来自 TypeScript 导出。

PropTypeDefaultDescription
modelValue
number
-The controlled value bound via `v-model` (Vue specific).
defaultValue
number
-The default value of the component when uncontrolled.

Slots

PropTypeDefaultDescription
default
slot
-Default slot content rendered inside the component root.

Parts

PropTypeDefaultDescription
root*
root
-The textarea element itself
This API reference is generated from `/packages/core` component schemas to keep React/Vue/Weapp docs consistent.

该组件尚无扩展说明文档。

键盘与焦点

Keyboard

跨 React、Vue 与小程序共享的交互与可读名称约定。

  • When read-only, the field stays focusable and value changes are ignored.
  • A field with text shows a button named Clear.
  • Activating it empties the field.
  • Clear returns focus to the field.
  • A disabled, read-only, or empty field has no Clear button.

行为契约

Contract

props、默认值和运行时状态。

  • A disabled field ignores changes.
  • Typed text longer than maxLength is cut.
  • An omitted max length does not cut the text.
  • When a max length is set, the field reads how many characters are used.
  • The character count is included in aria-describedby.
  • A required field is announced as required.
  • A passed aria-label names the field.
  • On the mini program, an omitted aria-label is left off the field.
  • In static HTML, a label named Message names the field.
  • On the mini program, an empty description is left off.