11<div align =" center " >
22 <h1 >@rc-component/input</h1 >
3- <p ><sub >Ant Design 生态的一部分。</sub ></p >
4- <img alt =" Ant Design " height =" 32 " src =" https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg " />
5- <p >⌨️ React 输入框基础组件,支持前后缀、清除按钮、计数和组合输入。</p >
3+ <p ><sub ><img alt =" Ant Design " height =" 14 " src =" https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg " style =" vertical-align : -0.125em ;" /> Ant Design 生态的一部分。</sub ></p >
4+ <p >📦 ⌨️ React 输入框基础组件,支持前后缀、清除按钮、计数和组合输入。</p >
65</div >
76
87<p align =" center " ><a href =" ./README.md " >English</a > | 简体中文</p >
@@ -65,48 +64,48 @@ npm start
6564
6665| 参数 | 类型 | 默认值 | 说明 |
6766| ------------ | ---------------------------------------------------------- | ---------- | --------------------------------------------------------------- |
68- | addonAfter | ` ReactNode ` | - | Element displayed after the input. |
69- | addonBefore | ` ReactNode ` | - | Element displayed before the input. |
70- | allowClear | ` boolean \| { disabled?: boolean; clearIcon?: ReactNode } ` | ` false ` | Show a clear button for the current value. |
71- | className | ` string ` | - | Class name for the input element. |
72- | classNames | ` InputProps['classNames'] ` | - | Semantic class names for input slots. |
73- | count | ` CountConfig ` | - | Custom count strategy, limit, visibility, and exceed formatter. |
74- | defaultValue | ` string \| number \| readonly string[] \| bigint ` | - | Initial input value. |
75- | disabled | ` boolean ` | ` false ` | Disable the input. |
76- | htmlSize | ` number ` | - | Native input ` size ` attribute. |
77- | maxLength | ` number ` | - | Native input ` maxLength ` attribute. |
78- | prefix | ` ReactNode ` | - | Prefix content inside the input wrapper. |
79- | prefixCls | ` string ` | ` rc-input ` | Class name prefix. |
80- | showCount | ` boolean \| { formatter: ShowCountFormatter } ` | ` false ` | Show character count. Prefer ` count.show ` for new code. |
81- | styles | ` InputProps['styles'] ` | - | Semantic styles for input slots. |
82- | suffix | ` ReactNode ` | - | Suffix content inside the input wrapper. |
83- | type | ` InputProps['type'] ` | ` text ` | Native input type. Use ` TextArea ` for textarea behavior. |
84- | value | ` string \| number \| readonly string[] \| bigint ` | - | Controlled input value. |
85- | onChange | ` React.ChangeEventHandler<HTMLInputElement> ` | - | Triggered when the value changes. |
86- | onClear | ` () => void ` | - | Triggered when the clear button is clicked. |
87- | onPressEnter | ` React.KeyboardEventHandler<HTMLInputElement> ` | - | Triggered when Enter is pressed. |
67+ | addonAfter | ` ReactNode ` | - | 输入后显示的元素。 |
68+ | addonBefore | ` ReactNode ` | - | 输入之前显示的元素。 |
69+ | allowClear | ` boolean \| { disabled?: boolean; clearIcon?: ReactNode } ` | ` false ` | 显示当前值的清除按钮。 |
70+ | className | ` string ` | - | 输入元素的className称。 |
71+ | classNames | ` InputProps['classNames'] ` | - | 输入槽的语义className称。 |
72+ | count | ` CountConfig ` | - | 自定义计数策略、限制、可见性和超出格式化程序。 |
73+ | defaultValue | ` string \| number \| readonly string[] \| bigint ` | - | 初始输入值。 |
74+ | disabled | ` boolean ` | ` false ` | 禁用输入。 |
75+ | htmlSize | ` number ` | - | 本机输入 ` size ` 属性。 |
76+ | maxLength | ` number ` | - | 本机输入 ` maxLength ` 属性。 |
77+ | 前缀 | ` ReactNode ` | - | 输入包装器内的前缀内容。 |
78+ | prefixCls | ` string ` | ` rc-input ` | className前缀。 |
79+ | showCount | ` boolean \| { formatter: ShowCountFormatter } ` | ` false ` | 显示字符数。新代码首选 ` count.show ` 。 |
80+ | styles | ` InputProps['styles'] ` | - | 输入槽的语义样式。 |
81+ | 后缀 | ` ReactNode ` | - | 输入包装器内的后缀内容。 |
82+ | type | ` InputProps['type'] ` | ` text ` | 本机输入类型。使用 ` TextArea ` 进行文本区域行为。 |
83+ | 价值 | ` string \| number \| readonly string[] \| bigint ` | - | 受控输入值。 |
84+ | onChange | ` React.ChangeEventHandler<HTMLInputElement> ` | - | 当值改变时触发。 |
85+ | onClear | ` () => void ` | - | 单击清除按钮时触发。 |
86+ | onPressEnter | ` React.KeyboardEventHandler<HTMLInputElement> ` | - | 当按下 Enter 时触发。 |
8887
8988### TextArea
9089
9190| 参数 | 类型 | 默认值 | 说明 |
9291| ------------ | ---------------------------------------------------------- | ------------- | --------------------------------------------------------------- |
93- | allowClear | ` boolean \| { disabled?: boolean; clearIcon?: ReactNode } ` | ` false ` | Show a clear button for the current value. |
94- | autoSize | ` boolean \| { minRows?: number; maxRows?: number } ` | ` false ` | Auto resize height by content. |
95- | className | ` string ` | - | Class name for the textarea. |
96- | classNames | ` TextAreaProps['classNames'] ` | - | Semantic class names for textarea slots. |
97- | count | ` CountConfig ` | - | Custom count strategy, limit, visibility, and exceed formatter. |
98- | defaultValue | ` string \| number \| readonly string[] \| bigint ` | - | Initial textarea value. |
99- | maxLength | ` number ` | - | Native textarea ` maxLength ` attribute. |
100- | prefixCls | ` string ` | ` rc-textarea ` | Class name prefix. |
101- | showCount | ` boolean \| { formatter: ShowCountFormatter } ` | ` false ` | Show character count. Prefer ` count.show ` for new code. |
102- | style | ` React.CSSProperties ` | - | Inline styles for the textarea. |
103- | styles | ` TextAreaProps['styles'] ` | - | Semantic styles for textarea slots. |
104- | suffix | ` ReactNode ` | - | Suffix content inside the textarea wrapper. |
105- | value | ` string \| number \| readonly string[] \| bigint ` | - | Controlled textarea value. |
106- | onChange | ` React.ChangeEventHandler<HTMLTextAreaElement> ` | - | Triggered when the value changes. |
107- | onClear | ` () => void ` | - | Triggered when the clear button is clicked. |
108- | onPressEnter | ` React.KeyboardEventHandler<HTMLTextAreaElement> ` | - | Triggered when Enter is pressed. |
109- | onResize | ` (size: { width: number; height: number }) => void ` | - | Triggered when textarea size changes. |
92+ | allowClear | ` boolean \| { disabled?: boolean; clearIcon?: ReactNode } ` | ` false ` | 显示当前值的清除按钮。 |
93+ | autoSize | ` boolean \| { minRows?: number; maxRows?: number } ` | ` false ` | 根据内容自动调整高度。 |
94+ | className | ` string ` | - | 文本区域的className称。 |
95+ | classNames | ` TextAreaProps['classNames'] ` | - | 文本区域槽的语义className称。 |
96+ | count | ` CountConfig ` | - | 自定义计数策略、限制、可见性和超出格式化程序。 |
97+ | defaultValue | ` string \| number \| readonly string[] \| bigint ` | - | 初始文本区域值。 |
98+ | maxLength | ` number ` | - | 本机文本区域 ` maxLength ` 属性。 |
99+ | prefixCls | ` string ` | ` rc-textarea ` | className前缀。 |
100+ | showCount | ` boolean \| { formatter: ShowCountFormatter } ` | ` false ` | 显示字符数。新代码首选 ` count.show ` 。 |
101+ | 风格 | ` React.CSSProperties ` | - | 文本区域的内联样式。 |
102+ | styles | ` TextAreaProps['styles'] ` | - | 文本区域槽的语义样式。 |
103+ | 后缀 | ` ReactNode ` | - | textarea 包装器内的后缀内容。 |
104+ | 价值 | ` string \| number \| readonly string[] \| bigint ` | - | 受控文本区域值。 |
105+ | onChange | ` React.ChangeEventHandler<HTMLTextAreaElement> ` | - | 当值改变时触发。 |
106+ | onClear | ` () => void ` | - | 单击清除按钮时触发。 |
107+ | onPressEnter | ` React.KeyboardEventHandler<HTMLTextAreaElement> ` | - | 当按下 Enter 时触发。 |
108+ | onResize | ` (size: { width: number; height: number }) => void ` | - | 当文本区域大小改变时触发。 |
110109
111110### Refs
112111
@@ -125,7 +124,7 @@ inputRef.current?.focus();
125124textareaRef .current ?.blur ();
126125```
127126
128- | Ref | Methods |
127+ | Ref | 方法 |
129128| ------------- | --------------------------------------------------------------------------------------- |
130129| ` InputRef ` | ` focus(options) ` , ` blur() ` , ` select() ` , ` setSelectionRange() ` , ` input ` , ` nativeElement ` |
131130| ` TextAreaRef ` | ` focus() ` , ` blur() ` , ` resizableTextArea ` , ` nativeElement ` |
@@ -147,11 +146,11 @@ npm run build
147146npm run prepublishOnly
148147```
149148
150- The release flow is handled by ` @rc-component/np ` through the ` rc-np ` command after the package build.
149+ 包构建完成后,发布流程由 ` @rc-component/np ` 通过 ` rc-np ` 命令处理。
151150
152151## 许可证
153152
154- @rc-component/input is released under the [ MIT] ( ./LICENSE.md ) license.
153+ @rc-component/input 基于 [ MIT] ( ./LICENSE.md ) 许可证发布。
155154
156155[ npm-image ] : https://img.shields.io/npm/v/@rc-component/input.svg?style=flat-square
157156[ npm-url ] : https://npmjs.org/package/@rc-component/input
0 commit comments