Repository navigation
[M][D] DLS-687 feat(Card, Tile): add truncate prop to title and description - #1012
aammami-ledger wants to merge 7 commits into
Conversation
…ription Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Lumen PR reportTest coverageLibs must reach 80% on every metric. Δ is against the latest green
Internals (reported, not gated)
|
There was a problem hiding this comment.
🟡 Changes recommended
Long unbroken titles and descriptions can overflow and push adjacent content outside the card when truncation is disabled because the flex children lack min-w-0.
3 open issues
What changed in this PR
Adds an optional truncate prop to Lumen’s Card title and description components on React web and React Native. Consumers can enable wrapping while preserving single-line truncation by default.
Changes:
- Adds matching props and platform-specific wrapping behavior, preserving existing overrides.
- Adds tests, showcase stories, and documentation for both platforms.
- Includes separate patch version plans for both UI packages.
| File | Description |
|---|---|
libs/ui-rnative/src/lib/Components/core/Card/types.ts |
Declares and documents the native truncate props. |
libs/ui-rnative/src/lib/Components/core/Card/Card.tsx |
Makes native text clamping conditional. |
libs/ui-rnative/src/lib/Components/core/Card/Card.test.tsx |
Tests defaults, wrapping, and line-count overrides. |
libs/ui-rnative/src/lib/Components/core/Card/Card.stories.tsx |
Demonstrates native truncation and wrapping. |
libs/ui-rnative/src/lib/Components/core/Card/Card.mdx |
Documents native wrapping usage. |
libs/ui-react/src/lib/Components/core/Card/types.ts |
Declares and documents the web truncate props. |
libs/ui-react/src/lib/Components/core/Card/Card.tsx |
Switches between truncation and wrapping classes. |
libs/ui-react/src/lib/Components/core/Card/Card.test.tsx |
Tests classes and prevents forwarding truncate to the DOM. |
libs/ui-react/src/lib/Components/core/Card/Card.stories.tsx |
Demonstrates web truncation and wrapping. |
libs/ui-react/src/lib/Components/core/Card/Card.mdx |
Documents web wrapping usage. |
.nx/version-plans/version-plan-1795539502001-ui-rnative.md |
Adds the native package’s patch release plan. |
.nx/version-plans/version-plan-1795539502000-ui-react.md |
Adds the web package’s patch release plan. |
Review effort: Balanced
Add min-w-0 to the non-truncated title and description so long unbroken values wrap inside CardContentRow instead of pushing siblings out of the card, and use a dynamic docs source for the web TruncationShowcase story. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ase for stories Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
0f2d20d to
8f10e12
Compare
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
wrap-break-word keeps the longest unbroken word as the minimum width, so a Tile used as a flex or grid item could still overflow. wrap-anywhere lets the text shrink and wrap, and Card now matches Tile. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
| * When `false`, the text wraps. | ||
| * @default true | ||
| */ | ||
| truncate?: boolean; |
There was a problem hiding this comment.
[Question] I wonder if we should name this multiline instead, given we use it already in TextInput
There was a problem hiding this comment.
Yes it could be more accurate, and higher-level API (we need to align everything on that then)
Also, do we want to support numberOfLines props ?
In that case maybe having the combo:
truncate + numberOfLines makes more sense than multilines + numberOfLines ?
Or maybe just numberOfLines should be the only property for the comp
The dynamic source mode dropped truncate={false} from the snippet. Write
the props inline and use the default code source, like the Tile story.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
CardContentTitle, CardContentDescription, TileTitle and TileDescription
take the same numberOfLines API on web and React Native: 1 by default,
2 or more to clamp (web: 2 to 9), and 0 for no limit, like React Native.
An explicit numberOfLines={undefined} now falls back to the default of
one line on React Native Card parts instead of removing the limit. A
migration covers it.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|





Context
The title and description of
CardandTilealways clamp to one line, with no clean way to let long text wrap. Atruncateprop (defaulttrue, so no behavior change) lets consumers opt out on both platforms.Closes DLS-687
Technical details
CardContentTitle,CardContentDescription,TileTitleandTileDescriptiontaketruncate. On web,truncate={false}swaps thetruncateclass forwrap-break-word(plusmin-w-0on Card, so text can shrink insideCardContentRow).truncate={false}dropsnumberOfLines/ellipsizeModeon text children; an explicitnumberOfLinesstill wins on Card.TruncationShowcasestory and mdx docs for both components on both libs, plus one patch version plan per package and component.component-storiesskill now allowsTruncationShowcasealongsideResponsivenessShowcase.How to test
Core/CardandCore/Tile→TruncationShowcase(web and React Native): the default item clamps with an ellipsis, thetruncate={false}one wraps and grows taller.🤖 Generated with Claude Code