代码拉取完成,页面将自动刷新
多行文本域,用于输入多行文本
import { TextArea } from "@ls-design/ui-react";
<TextArea />
<TextArea rows="6" />
<TextArea autosize />
<TextArea showcount />
<TextArea showcount maxlength="50" />
<TextArea disabled />
export default () => {
return (
<TextArea
onBlur={(event) => {
Toast.text(`${event.target.value}, blur`);
}}
onInput={(event) => {
Toast.text(`${event.target.value}, input`);
}}
onFocus={(event) => {
Toast.text(`${event.target.value}, focus`);
}}
onCompositionStart={(event) => {
Toast.text(`${event.target.value}, compositionStart`);
}}
/>
);
};
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
value | 输入值 | string |
|
placeholder | 提示文本 | string |
|
rows | 行数 | number |
2 |
maxlength | 最大字符数 | number |
- |
showcount | 显示字数 | boolean |
false |
autocomplete | 自动补全 | boolean |
false |
disabled | 是否禁用 | boolean |
false |
readonly | 是否只读 | boolean |
false |
id | textarea 元素的 id,常用来配合 label 使用 | string |
|
onInput | 文本域内容变化时触发 | (e: { detail: { value: string } }) => void |
|
onFocus | 文本域获得焦点时触发 | (e: { detail: { value: string } }) => void |
|
onBlur | 文本域失去焦点时触发 | (e: { detail: { value: string } }) => void |
|
onCompositionStart | 输入法编辑器开始新的输入时触发 | ()=> void |
组件提供了以下 CSS变量,可用于自定义样式
名称 | 说明 | 默认值 |
---|---|---|
--textarea-color |
文字颜色 | #242729 |
--textarea-font-size |
文字大小 | 14px |
--textarea-text-align |
文字位置 | left |
--textarea-text-count-align |
统计字数位置 | right |
--textarea-count-color |
统计字数颜色 | #242729 |
--textarea-border-color |
文本域边框颜色 | #242729 |
--textarea-placeholder-color |
占位文字颜色 | #242729 |
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。