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

Allow setting title via prop #779

Merged
merged 1 commit into from Aug 30, 2022

Conversation

stefanprobst
Copy link
Contributor

This enables svgr's titleProp option which allows adding a <title> to jsx icons via prop.

@RobinMalfait RobinMalfait self-assigned this Aug 30, 2022
@RobinMalfait
Copy link
Contributor

Hey! Thank you for your PR!
Much appreciated! 🙏

I don't think this is necessary because all props are already added to the SVG (e.g.: https://unpkg.com/browse/@heroicons/react@2.0.8/20/solid/AcademicCapIcon.js)

Here is an example in a CodeSandbox. If you look at the DOM you will see the title attribute: https://codesandbox.io/s/hardcore-pond-p51n6x?file=/src/App.js

@stefanprobst
Copy link
Contributor Author

hi, the titleProp option adds a title element as a child of the svg (not a title attribute on the svg) - i think for svgs this is the appropriate approach (?)

@stefanprobst
Copy link
Contributor Author

actually, hovering over the svg in your codesandbox does not show a title tooltip for me

@RobinMalfait RobinMalfait reopened this Aug 30, 2022
@RobinMalfait
Copy link
Contributor

Aha yeah ok that makes sense. Thanks for the PR!

@RobinMalfait RobinMalfait merged commit ea53d07 into tailwindlabs:master Aug 30, 2022
@stefanprobst stefanprobst deleted the feat/title-prop branch August 30, 2022 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants