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

Add titleProp option #88

Closed
gregberge opened this issue May 12, 2018 · 2 comments
Closed

Add titleProp option #88

gregberge opened this issue May 12, 2018 · 2 comments
Milestone

Comments

@gregberge
Copy link
Owner

As mentioned in #75, it would be nice to be able to specify a title using props. To do it, my proposition is to add a boolean option "titleProp" defaulting to false. When activated, user would be able to specify the title of the SVG using props.

Usage in command line

svgr --title-prop

Usage in Node / Webpack

transform("...", { titleProp: true })

Usage in React, when the option is activated

import SvgrComponent from './SvgrComponent'

<SvgrComponent title="This is a title" />
// The output will be:
// <svg><title>This is a title</title></svg>
// Instead of:
// <svg title="This is a title" />
@gregberge gregberge added this to the v2 milestone May 12, 2018
@gregberge gregberge changed the title Add a titleProp option Add titleProp option May 12, 2018
@gregberge gregberge mentioned this issue May 12, 2018
8 tasks
marques-kevin added a commit to marques-kevin/svgr that referenced this issue May 22, 2018
marques-kevin added a commit to marques-kevin/svgr that referenced this issue May 23, 2018
marques-kevin added a commit to marques-kevin/svgr that referenced this issue May 23, 2018
marques-kevin added a commit to marques-kevin/svgr that referenced this issue May 23, 2018
gregberge pushed a commit that referenced this issue May 24, 2018
@sbmadhav
Copy link

sbmadhav commented Jan 14, 2019

@neoziro, instead of this can we just pass as below, this will support ARIA as well -

<SvgrComponent aria-labelledby='fancy-svg-id'>
    <title id='fancy-svg-id'> Title goes here </title>
</SvgrComponent>

@gregberge
Copy link
Owner Author

Yes I think it is a good idea, why not in future.

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

No branches or pull requests

2 participants