[Feature Request]: Badge component should support text truncation with ellipsis
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- react, scss, typescript
- Domain
- frontend
Research direction
Start by locating the Badge component implementation and its tests, then inspect how its internal markup handles children and sizing. Check how Badge is used in Table cells and how the component’s styling is tested. Done means an opt-in truncation behavior shows an ellipsis as the available width changes without forcing the table row to grow.
Written by the indexing model from the issue text.
Description
Description
Use case
When using Badge inside a Table cell to display dynamic content (e.g., resource tags like aws:cloudformation:stack-name=my-very-long-stack-name), long text causes the Badge to expand beyond the column width. Since Badge renders as an inline-block element, the table row height increases when the column is resized and the Badge cannot wrap internally, so it forces the row to grow.
There is currently no way to constrain Badge content with standard CSS (overflow: hidden; text-overflow: ellipsis; white-space: nowrap) because the text is not a direct child of the overflow container, it's nested inside Badge's internal markup.
Proposed solution
Add a truncate boolean prop (or similar) to Badge that enables single-line text overflow with ellipsis:
<Badge truncate>aws:cloudformation:stack-name=my-very-long-value</Badge>
When enabled, the Badge's internal text container would apply:
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
And the Badge itself would respect a max-width (either from a parent container or an explicit prop) rather than always sizing to its content.
Workarounds attempted
- Wrapping Badge in a div with overflow: hidden — clips visually but does not show ellipsis
- Placing a styled span inside Badge children with text-overflow: ellipsis — does not respond to column resizing because Badge sizes to its content, creating a circular width dependency
- Programmatic text truncation
(string.slice(0, N) + '…')— works but is not responsive to layout changes
Code of Conduct
- I agree to follow this project's Code of Conduct
- I checked the current issues for duplicate requests
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 248
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 83
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudscape-design/components
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
cloudscape-design/components#5184 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cloudscape-design/components#5152 · 1 comment ·
Maintainers usually reply within 2 days
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 15/100
cloudscape-design/components#5149 · 1 comment ·
Maintainers usually reply within 2 days
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
cloudscape-design/components#5117 · 2 comments ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
cloudscape-design/components#5106 · 1 comment ·
Maintainers usually reply within 2 days
All issues in cloudscape-design/components
Similar issues
-
bug hacktoberfest help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
libredb/libredb-studio#1941 ·
Maintainers usually reply within 1 day
-
chore other
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
alastair-smith/card-games#308 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
paperclipai/paperclip#17379 ·
Maintainers usually reply within 1 day
-
[good first issue, hacktoberfest] 🏯 Hacktoberfest Task - Add new Anime Quote 626 (good-first-issue)Opencommunity first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
lingdojo/kana-dojo#33040 · 1 comment · 5 reactions ·
Maintainers usually reply within 1 day
-
bug mobile ui
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day