Skip to content

How to append custom classNames to SVG components with svgProps.className specified? #770

Answered by jamonserrano
SevenOutman asked this question in Q&A
Discussion options

You must be logged in to vote
{
  expandProps: 'start' // (1)
  svgProps: {
    className: `{props.className ? props.className + ' rs-icon' : 'rs-icon'}`, // (2)
  },
}

(1) prevents external props from overriding the ones set in svgProps.
(2) appends the class name to the ones passed in.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@SevenOutman
Comment options

@vincerubinetti
Comment options

Answer selected by gregberge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants