Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Feature Request]: Badge component should support text truncation with ellipsis

Open
#4,625 1 comment 0 reactions 0 assignees View on GitHub

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

enhancement
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
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudscape-design/components

All issues in cloudscape-design/components

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.