Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/web/_design/多行文本框Textarea.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@

<hr />

##### 当已输入内容需要被快速移除时,可提供清空操作,清空入口应放置在文本框右上角,并避免遮挡输入内容。

<hr />

##### 与按钮搭配使用,可以为用户提供与输入内容相关联的具体操作,用以提交、发送或保存输入的文本信息。

<div class="legend">
Expand Down
6 changes: 6 additions & 0 deletions docs/web/api/textarea.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ Used for multiline text entry.

{{ base }}

### Clearable Multiline Text Box

Textarea with a clear operation can quickly clear the entered content.

{{ clearable }}

### Limit the maximum number of characters

Limits the maximum number of characters entered and displays the number of characters.
Expand Down
6 changes: 6 additions & 0 deletions docs/web/api/textarea.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ spline: form

{{ base }}

### 可清空内容多行文本框

带清空操作的多行文本框,可快捷清空输入过的内容。

{{ clearable }}

### 限制最大字符数

限制输入的最大字符数并展示字符数。
Expand Down
4 changes: 4 additions & 0 deletions docs/web/design/textarea.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@

<hr />

##### 当已输入内容需要被快速移除时,可提供清空操作,清空入口应放置在文本框右上角,并避免遮挡输入内容。

<hr />

##### 与按钮搭配使用,可以为用户提供与输入内容相关联的具体操作,用以提交、发送或保存输入的文本信息。

<div class="legend">
Expand Down
23 changes: 23 additions & 0 deletions style/web/components/textarea/_index.less
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,29 @@
.textarea-status(error);
}

&--clearable &__inner {
padding-right: @textarea-clearable-padding-right;
}

&__clear {
position: absolute;
top: @textarea-clear-icon-top;
right: @textarea-clear-icon-right;
z-index: 1;
display: inline-flex;
align-items: center;
justify-content: center;
color: @textarea-clear-icon-color;
font-size: @textarea-clear-icon-size;
line-height: 1;
cursor: pointer;
transition: color @anim-duration-base linear;

&:hover {
color: @textarea-clear-icon-color-hover;
}
}

&__info_wrapper {
display: flex;
column-gap: @textarea-tips-gap;
Expand Down
8 changes: 8 additions & 0 deletions style/web/components/textarea/_var.less
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
@textarea-placeholder-color: @text-color-placeholder;
@textarea-text-color: @text-color-primary;
@textarea-limit-color: @text-color-placeholder;
@textarea-clear-icon-color: @text-color-placeholder;
@textarea-clear-icon-color-hover: @text-color-secondary;
@textarea-bg-color-default: @bg-color-specialcomponent;
@textarea-bg-color-disabled: @bg-color-component-disabled;
@textarea-color-text-disabled: @text-color-disabled;
Expand All @@ -33,15 +35,21 @@
// 尺寸
@textarea-height: @comp-size-xxxl;
@textarea-tips-min-height: @comp-size-xs;
@textarea-clear-icon-size: @font-size-l;

// 字体
@textarea-font: @font-body-medium;
@textarea-tips-font: @font-body-small;

// 间距
@textarea-padding: calc(calc(@comp-size-m - @text-line-height-base) / 2) @comp-paddingLR-s;
@textarea-clearable-padding-right: @comp-paddingLR-xxl;
@textarea-tips-gap: @comp-margin-s;

// 位置
@textarea-clear-icon-top: calc(calc(@comp-size-m - @textarea-clear-icon-size) / 2);
@textarea-clear-icon-right: @comp-paddingLR-s;

// 边框
@textarea-border-color: @border-level-2-color;
@textarea-border-color-hover: @brand-color;
Expand Down