-
Notifications
You must be signed in to change notification settings - Fork 361
feat(Textarea): support count API
#4003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
33c283f to
07914dd
Compare
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new count API to the Textarea component, allowing developers to customize how the character counter is rendered.
Key Changes:
- Added
countprop that accepts boolean or a custom render function with context parameters (value, count, maxLength, maxCharacter) - Updated example to demonstrate custom count rendering with styled elements
- Modified internal logic to conditionally show/hide and render count based on the new
countprop
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/components/textarea/type.ts | Added count prop type definition to support boolean or custom render function |
| packages/components/textarea/textarea.md | Updated Chinese documentation to include the new count API |
| packages/components/textarea/textarea.en-US.md | Updated English documentation with the new count prop description |
| packages/components/textarea/_example/maxlength.tsx | Added example demonstrating custom count rendering with inline styles |
| packages/components/textarea/Textarea.tsx | Implemented count logic with conditional rendering based on prop value |
| test/snap/snapshots/ssr.test.jsx.snap | Updated SSR snapshot to reflect custom count rendering in example |
| test/snap/snapshots/csr.test.jsx.snap | Updated CSR snapshot to reflect custom count rendering in example |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
088e080 to
4bd1c04
Compare

🤔 这个 PR 的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
countAPI TDesignOteam/tdesign-api#785📝 更新日志
feat(Textarea): 支持
countAPI,用于自定义计数元素的渲染本条 PR 不需要纳入 Changelog
☑️ 请求合并前的自查清单