Skip to content

[M][D] DLS-687 feat(Card, Tile): add truncate prop to title and description - #1012

Open
aammami-ledger wants to merge 7 commits into
mainfrom
DLS-687-card-truncate
Open

aammami-ledger wants to merge 7 commits into
mainfrom
DLS-687-card-truncate

Conversation

@aammami-ledger

@aammami-ledger aammami-ledger commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Context

The title and description of Card and Tile always clamp to one line, with no clean way to let long text wrap. A truncate prop (default true, so no behavior change) lets consumers opt out on both platforms.

Closes DLS-687

Technical details

  • CardContentTitle, CardContentDescription, TileTitle and TileDescription take truncate. On web, truncate={false} swaps the truncate class for wrap-break-word (plus min-w-0 on Card, so text can shrink inside CardContentRow).
  • React Native: truncate={false} drops numberOfLines/ellipsizeMode on text children; an explicit numberOfLines still wins on Card.
  • Tests, a TruncationShowcase story and mdx docs for both components on both libs, plus one patch version plan per package and component.
  • The component-stories skill now allows TruncationShowcase alongside ResponsivenessShowcase.
<CardContentTitle truncate={false}>A very long title that wraps</CardContentTitle>
<TileTitle truncate={false}>A very long title that wraps</TileTitle>

How to test

  1. Open Core/Card and Core/Tile → TruncationShowcase (web and React Native): the default item clamps with an ellipsis, the truncate={false} one wraps and grows taller.
  2. Add before/after screenshots. Not yet checked visually: only unit tests, lint and typecheck have run.

🤖 Generated with Claude Code

…ription

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@aammami-ledger
aammami-ledger requested a review from a team as a code owner November 25, 2026 10:15
Copilot AI balanced review requested due to automatic review settings November 25, 2026 10:15
@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ldls Ready Ready Preview Nov 30, 2026 4:14pm UTC
ldls-react-native Ready Ready Preview Nov 30, 2026 4:14pm UTC

Request Review

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Lumen PR report

Test coverage

Libs must reach 80% on every metric. Δ is against the latest green main; italic rows did not run in this PR and show main's numbers.

Lib Lines Statements Functions Branches Gate
design-core 99.50% 99.51% 100.00% 90.90% not run
lint-plugin 97.10% 96.00% 100.00% 93.75% not run
migrations 96.44% (±0) 95.13% (±0) 100.00% (±0) 89.21% (±0) ✅
symbols — — — — not run
ui-react 96.57% (±0) 95.95% (+0.01) 94.82% (+0.01) 92.29% (+0.09) ✅
ui-rnative 94.19% (±0) 93.98% (±0) 93.51% (±0) 86.44% (+0.02) ✅
utils-shared 98.94% 99.02% 99.24% 94.22% not run
Internals (reported, not gated)
Project Lines Statements Functions Branches
adoption-tool 78.33% 78.10% 84.43% 84.73%
design-build 88.30% 87.63% 92.85% 77.17%
design-sources 90.10% 88.63% 89.61% 85.94%
repo-tools 39.26% 39.22% 70.74% 41.53%
sync-figma 81.35% 81.76% 79.10% 88.39%

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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

aammami-ledger and others added 2 commits November 25, 2026 12:01
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>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@aammami-ledger aammami-ledger changed the title [M][D] DLS-687 feat(Card): add truncate prop to CardContentTitle and CardContentDescription [M][D] DLS-687 feat(Card, Tile): add truncate prop to title and description Nov 25, 2026
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;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[Question] I wonder if we should name this multiline instead, given we use it already in TextInput

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

@zel-kass zel-kass left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

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>
@sonarqubecloud

Copy link
Copy Markdown

This branch was successfully deployed

2 active deployments
Preview – ldls — 2b6a328f Deployed Nov 30, 2026 by vercel[bot]
Preview – ldls-react-native — 2b6a328f Deployed Nov 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chromatic This will run Chromatic on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants