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

If I want to use an icon on a ::before{content} property, is this possible with this library? #528

Closed
hanoii opened this issue Jan 14, 2019 · 3 comments

Comments

@hanoii
Copy link

hanoii commented Jan 14, 2019

No description provided.

@jacobwgillespie
Copy link
Member

I think this is not directly possible - this library provides icons as React / Styled Components, and as far as I'm aware, it's not possible to use a React component in a ::before{content} CSS property.

I'll let you know if this is possible in the future, in the meantime I'll close this issue.

@aakhan89
Copy link

I think this is not directly possible - this library provides icons as React / Styled Components, and as far as I'm aware, it's not possible to use a React component in a ::before{content} CSS property.

I'll let you know if this is possible in the future, in the meantime I'll close this issue.

Any luck ?

@jacobwgillespie
Copy link
Member

@aakhan89 it doesn't look like React supports this, no - ::before{content} can only be a string. You're likely better off wrapping the element in another element like a <div> and using CSS positioning to place the icon:

<div>
  <Icon />
  <OtherElement />
</div>

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

3 participants