For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt, and this page is available as Markdown at /apps-plugin/docs/components/form/input.md.

input

单行文本输入组件,支持多种输入类型(文本、数字、密码等)及受控/非受控模式。

扫码预览

扫码预览 input

Props

属性名类型默认值必填说明
classNamestring-否组件类名
confirmType"search" | "next" | "send" | "go" | "done"'send'否键盘右下角确认按钮的类型
defaultValuestring-否输入框的默认值,用于非受控组件
disabledbooleanfalse否是否禁用
idstring-否元素的唯一标识
keystring | number | null-否React key 属性
maxlengthnumber140否最大输入长度
onBlur(event: BaseEvent<"bindblur", InputBlurEvent>) => void-否失焦时触发
onConfirm(event: BaseEvent<"bindconfirm", InputConfirmEvent>) => void-否点击键盘确认按钮时触发
onFocus(event: BaseEvent<"bindfocus", InputFocusEvent>) => void-否聚焦时触发
onInput(event: BaseEvent<"bindinput", InputInputEvent>) => void-否输入内容变化时触发
onSelectionChange(event: BaseEvent<"bindselection", InputSelectionEvent>) => void-否选择区域变化时触发
placeholderstring-否占位符文本
readonlybooleanfalse否是否只读
refRef<InputRef>-否用于获取组件实例的 ref
showSoftInputOnFocusbooleantrue否聚焦时是否显示软键盘
styleCSSProperties-否组件样式
type"number" | "text" | "digit" | "password" | "tel" | "email"'text'否输入类型
valuestring-否输入框的当前值,用于受控组件

Ref 方法

方法名类型说明
blur() => Promise<void>失焦输入框
focus() => Promise<void>聚焦输入框
getValue() => Promise<{ selectionEnd: number; selectionStart: number; value: string }>获取输入框的值和选区起止位置,返回 { value, selectionStart, selectionEnd }。
setSelectionRange(selectionStart: number, selectionEnd: number) => Promise<void>设置选择区域
setValue(value: string) => Promise<void>设置输入框的值