[犀牛鸟]feat(Textarea): add clearable prop to support clearing content - #6782
Open
zjh0326 wants to merge 4 commits into
Open
[犀牛鸟]feat(Textarea): add clearable prop to support clearing content#6782zjh0326 wants to merge 4 commits into
zjh0326 wants to merge 4 commits into
Conversation
- Add clearable prop to Textarea component - Display clear button when clearable=true and value is not empty - Click to clear input content - Support dark mode with CSS variables - Add example in _example/base.vue Close Tencent#2566
zjh0326
requested review from
Cat1007,
PengYYYYY,
Wesley-0808,
chaishi,
liweijie0812,
uyarn,
zhangpaopao0609 and
zydemail
as code owners
July 3, 2026 09:43
16 tasks
Collaborator
|
/update-common 2608 |
Collaborator
TDesign Component Site Preview Open
|
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Close #2566
🤔 这个 PR 的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
详见技术规格书:
Textarea可清空内容功能-技术规格书.md
问题背景
Textarea 组件目前没有清空按钮,用户需要手动全选删除,操作繁琐。与 Input 组件的
clearable功能不一致,用户体验割裂。解决方案
为 Textarea 组件添加
clearable属性,当设置为true时,在文本框右上角显示清空按钮。实现细节:
Props 定义(
props.ts+type.ts):clearable?: boolean属性false组件逻辑(
textarea.tsx):clearable=true且输入框有内容时显示按钮change事件var(--td-*)CSS 变量,自动适配浅色/深色主题示例代码(
_example/base.vue):clearable属性的使用示例API 变化
新增 Props:
视觉效果
默认状态:浅灰色图标(var(--td-text-color-secondary))
悬停状态:蓝色图标(var(--td-brand-color)) + 圆形背景高亮
点击状态:按压缩放(scale(0.85)) + 背景加深
深色模式:自动适配(使用 CSS 变量)
tdesign-vue-next
feat(Textarea): 添加 clearable 属性支持清空内容
新增 clearable prop
点击清空按钮可清空输入内容
支持深色模式
白天模式:


夜间模式:
📝 更新日志
添加示例代码
☑️ 请求合并前的自查清单
_example/base.vuetype.ts