smile2emoji is a simple-to-use JavaScript library that converts text emoticons like :), ^^, :blush: and even Unicode strings into their corresponding emoji images (😊).
It can scan text for emoticon patterns and replace them with emoji. This can help make conversations and content more visual and expressive.
1. Install the smile2emoji with NPM.
# NPM $ npm i smile2emoji
2. The library exports four easy-to-use functions for converting text, detecting emoji patterns, and more. The main checkText() function scans a string for any defined emoticon patterns like :) or ^^ and replaces them with the corresponding emoji.
import { checkText } from 'smile2emoji'
// OR from a CDN
import { checkText } from "https://cdn.skypack.dev/smile2emoji"; const emoji = checkText(':)'); 3. The fromUnicodeToEmoji() is a specialized function that directly translates Unicode to emojis
import { fromUnicodeToEmoji } from 'smile2emoji'
// OR from a CDN
import { fromUnicodeToEmoji } from "https://cdn.skypack.dev/smile2emoji"; // ☁️
const emoji = fromUnicodeToEmoji('2601'); 4. The checkTextWithAutoSuggestions() and checkTextWithAutoSuggestionsAndUnicode() functions detect emoji syntax and replace it with the appropriate emoji even if it’s not an exact match.
import { checkTextWithAutoSuggestions } from 'smile2emoji'
import { checkTextWithAutoSuggestionsAndUnicode } from 'smile2emoji'
// OR from a CDN
import { checkTextWithAutoSuggestions } from "https://cdn.skypack.dev/smile2emoji";
import { checkTextWithAutoSuggestionsAndUnicode } from "https://cdn.skypack.dev/smile2emoji"; // 🎾
emoji = checkTextWithAutoSuggestions(':tenn');
// 🎾
emoji = checkTextWithAutoSuggestionsAndUnicode(':tenn'); v3.17.2 (04/21/2025)
v3.17.1 (02/15/2025)
v3.17.0 (12/14/2024)
v3.15.0/1 (10/09/2024)
v3.14.0 (10/03/2024)
v3.13.0 (07/09/2024)
v3.12.0 (06/02/2024)
v3.11.0 (03/02/2024)
v3.10.0 (02/04/2024)
v3.9.1 (01/31/2024)
v3.9.0 (12/28/2023)
The post Convert Text Emoticons to Emoji – smile2emoji appeared first on CSS Script.
Since its release in 1997, Mortal Kombat: Annihilation’s place in the annals of video game…
Netflix has confirmed that it is developing Grown Ups 3 with Adam Sandler, over a…
Netflix has another big-budget comic book adaptation in the works, with the streamer giving a…
WASHINGTON, (WOWO) — U.S. Sen. Todd Young (R-Ind.) is part of a group of senators…
INDIANAPOLIS, Ind. (WOWO) — Indiana Governor Mike Braun signed Senate Enrolled Act 78 on Wednesday,…
An Immigration and Customs Enforcement ICE officer's badge and weapon are seen in Washington, D.C.,…
This website uses cookies.