Repository navigation
feat: TextTruncate - #1250
Merged
Merged
feat: TextTruncate#1250
Conversation
🦋 Changeset detectedLatest commit: c927786 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
ariser
approved these changes
Oct 6, 2026
ariser
left a comment
Collaborator
There was a problem hiding this comment.
Niceee, great improvement
ariser
reviewed
Oct 7, 2026
Contributor
Storybook Preview Deployed✅ Preview URL: https://click-hu2g03w78-clickhouse.vercel.app Built from commit: |
Contributor
Chromatic Storybook
Built from commit: Statuses as of the end of the run. The build link shows the live review state. |
5 of 8 tasks
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.
TextTruncate component
Summary
Adds
TextTruncate(end or middle ellipsis; tooltip and tab stop while truncated) and deprecatesEllipsisContentandMiddleTruncator. CUI-283. No Figma frame.Component name:
TextTruncateType: New Component, Component Deprecation (
EllipsisContent,MiddleTruncator)Motivation
EllipsisContentis hover-only, measures only on render, has no middle mode or width cap; projects used multiple custom wrappers which can be replaced.Design reference
Proposed API
classNameandrefforwardingTextTruncate.types.ts)Variants & states
ellipsisPositionend|middleAccessibility
span/div(or the givencomponent);role="group"only on a plainspan/div, never over a native rolearia-labelledbyto itself), a tooltip that repeats the name adds noaria-describedby, middle mode hides its two visual halves (aria-hidden) behind one visually hidden full copy. Known gap: a consumeraria-describedbyreplaces the tooltip description instead of merging with it<body>TextTruncatesets no text color. axe reportscolor-contrastin two light-theme stories only because ofLink's own color (#437eef, 3.83:1), a pre-existing token issue tracked separatelyTheming
src/theme/tokens(no hardcoded colors, spacing, or font sizes); one component-local custom property,--text-truncate-max-widthImplementation checklist
src/components/TextTruncate/TextTruncate.tsxsrc/index.tsand the./TextTruncatesubpath inpackage.jsonComponentName.module.css, BEM class names) using theme tokens as CSS variables (var(--click-*)): plus a new shared modulesrc/styles/visually-hidden.module.css(.sr-only)TextTruncateProps,TextTruncateEllipsisPositionanytypes usedTesting
TextTruncate.test.tsx(31) andsrc/hooks/internal/useIsTruncated.test.tsx(7)toHaveAccessibleName): accessible names, descriptions, roles and tab stopsid/aria-*TextTruncate.stories.tsx(13 stories)TextTruncatein this PRDocumentation
showTooltip={false}in grids and large lists,component={Text}instead of a<Text>child,ellipsisContent={false}inBadge, cap the width of inline-flex controls such asLink)Changeset
minorfor new components,patchfor changes/fixes)Security checklist
dangerouslySetInnerHTMLRollout & migration (for component changes only)
@deprecatedJSDoc:EllipsisContent,EllipsisContentProps,MiddleTruncator;EllipsisContentandMiddleTruncatorcode is untouched. Intended difference for later migrations: theTextTruncatetooltip stays open while hovered (WCAG 1.4.13)Preview
See storybook for interactive examples.