patternfly / patternfly/patternfly-react

Truncate - Update Truncate to pass in custom `tooltipContent`.

Open
#12,033 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Stale
Dominant language
TypeScript
Stars
862
Forks
392
Avg merge
4d 8h
Merged PRs (30d)
9

Description

Is this a new component or an extension of an existing one?
The existing component is the [Truncate /] component.

Describe the feature
The feature is an enhancement to the PatternFly [Truncate /] component that allows a developer to customize or override the content of the tooltip that the component automatically provides.

Any other information?
The existing [Truncate /] component automatically adds a tooltip that displays the full, un-truncated text when the user hovers over the truncated element. This creates an issue when the developer needs to provide a custom tooltip (like one with a description and the full name) because it results in two tooltips appearing simultaneously. This blocks RHCLOUD-41396

The expected behavior is to add a new prop to [Truncate /]}}—perhaps called {{tooltipContent or a function prop that overrides it—that accepts either a string or an element as its value. When this new prop is used, the [Truncate /] component should display the custom content in its tooltip instead of the default un-truncated text. This allows for a single, customized tooltip to be shown when the text is truncated.

Are there visuals for this feature? If applicable, please include examples for each state and for varying widths
Include screenshots or links to Marvel or other mockups.

Example in use:

image


Jira Issue: PF-2757

Contributor guide

Open the contributing guide

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.

Research direction

Locate the existing PatternFly Truncate component and its tests, then read how the automatic tooltip is currently configured. Add the requested custom tooltip content API for string or element values, and verify that custom content replaces the default full text without producing two tooltips.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.