Skip to content
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

feat(ui): Improve Tag/Pill/Alias truncation #3904

Open
wants to merge 7 commits into
base: connie/truncate-by-chars
Choose a base branch
from

Conversation

connieelee
Copy link
Contributor

@connieelee connieelee commented Mar 18, 2025

Description

https://wandb.atlassian.net/browse/WB-23679

Stacked on #3902

Currently Tag/Pill/Alias common comps only support end truncation after ~24 chars. For an upcoming feature, we need to display tags with middle truncation after 16 chars.

The current truncation strategy uses CSS, which works well for start/end truncation but not middle truncation. It also doesn't truncate to exact char counts (go to storybook and count the chars to see what I mean). For these reasons, we're switching to use the new TruncateByCharsWithTooltip component for unified & more robust truncation functionality.

  • All tag/pill/alias comps with text now accept maxChars and truncationPart props. Defaults to 24 char end truncation to match existing behavior.
  • Ensures we display tooltips if truncated (currently this only works for RemovableTag -- going forward we'll have truncation tooltips for for all tag/pill/alias variants)
  • Currently, tag comps accept Wrapper prop, which is not defined for pill/alias comps. TruncateByCharsWithTooltip provides unified handling for this as well, so we can remove all the Wrapper logic from tag comps

Testing

storybook

Screen.Recording.2025-03-18.at.3.20.32.PM.mov

@connieelee connieelee requested review from a team as code owners March 18, 2025 22:22
@circle-job-mirror
Copy link

circle-job-mirror bot commented Mar 18, 2025

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

recommend hide whitespace

@connieelee connieelee force-pushed the connie/truncate-tags branch from 4591535 to 46e8a62 Compare March 18, 2025 22:27
@connieelee connieelee force-pushed the connie/truncate-tags branch from 5876d2d to e5efa46 Compare March 18, 2025 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant