question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Return an IMG element instead of a SPAN

See original GitHub issue

Hi there guys!

First of all, thanks for the awesome work with emoji-mart! I just realized the component <Emoji /> returns something like this for the grinning emoji, for example:

<span class="emoji-mart-emoji"><span style="width: 24px; height: 24px; display: inline-block; background-image: url(&quot;https://unpkg.com/emoji-datasource@2.4.4/sheet_google_64.png&quot;); background-size: 4100%; background-position: 65% 37.5%;"></span></span>

Is there any possiblity to specify what type of element we would receive as return of the <Emoji /> component? For example, transforming the <span><span/></span> to a single <img /> element solved a few problems with my implementation!

Or to make it simpler: is there any way to setup the <Emoji /> to return an <img /> instead of a couple of spans?

EDIT: or the data that will compose the emoji? Like the BG position and stuff?

Thanks a lot guys! ❤️

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:11
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
baldariancommented, Jul 4, 2019

Are there any news on this ?

It would be also a good solution to pass the tagName as a prop (img, span or whatever) and then it would be used to render the JSX.

What do you think ?

0reactions
EtienneLemcommented, Jul 27, 2022

In latest version, <em-emoji> uses image by default.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript putting an image in a span - Stack Overflow
Instead, create the img element, set the attributes and append them to your span. var img = document.createElement('IMG'); img.
Read more >
<img>: The Image Embed element - HTML - MDN Web Docs
The HTML element embeds an image into the document. ... Image data from a CORS-enabled image returned from a CORS request can be...
Read more >
Using the image tag in React - Dave Ceddia
How do you refer to an image in React? The img tag is a bit weird. Learn how to include images in your...
Read more >
Span vs. Div: The Difference Explained in 1000 Words or Less
Span tags are used on small segments of text, links, images, and other HTML elements that appear inline with the surrounding content.
Read more >
Why this pattern - Span tags with class enclosing img in ...
Any ideas why they're using this pattern in LDS putting a class on an enclosing span img tag vs adding the class directly...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found