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

[Chip] Limit text length and truncate it with ellipsis #19133

Closed
1 task done
felipesilvati opened this issue Jan 8, 2020 · 3 comments
Closed
1 task done

[Chip] Limit text length and truncate it with ellipsis #19133

felipesilvati opened this issue Jan 8, 2020 · 3 comments
Labels
component: chip This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists

Comments

@felipesilvati
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

Summary 💡

The <Chip /> could receive a maxLength property that truncates with ellipsis

Examples 🌈

<Chip label='My Very Long text that needs to truncate' maxLength={2} />

Renders My...

Motivation 🔦

Avoids writing string truncate functions outside of this component.

@mbrookes mbrookes added component: chip This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists labels Jan 8, 2020
@mbrookes
Copy link
Member

mbrookes commented Jan 8, 2020

@felipesilvati The best approach currently is to apply a max-width CSS property on the chip: #18708

Duplicate of #18587

e.g.

<Chip style={{ maxWidth: 100 }} />

Capture d’écran 2020-01-08 à 22 10 15

@mbrookes mbrookes closed this as completed Jan 8, 2020
@hadasmaimon
Copy link

hadasmaimon commented May 17, 2020

It is very good,
But it would be nice if we could add a title

@oliviertassinari How do we add the html title attribute to a chip?
ie:

<Chip title={chipTitle} /> as <div title='allText'>your text</div>

image

Nice! It already exists, thanks!
image

@wishtree-rpatel
Copy link

wishtree-rpatel commented Sep 11, 2023

@felipesilvati I would be great if we can display tooltip on chip if elapses are present, don't know how to do that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: chip This is the name of the generic UI component, not the React module! duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants