As a React application developer, I recently built an app that needed to use TikTok Emojis, and I encountered a frustrating issue: TikTok Emojis are not regular emojis that can be expressed using Unicode.
At first, I tried using online image resources, but this introduced another troubling problem - image resources led to additional network requests, which wasn't what I wanted.
I was looking for an icon library similar to lucide-react to solve my problem. I searched extensively online and even posted on StackOverflow for help (though my question was closed because it was considered seeking recommendations for software libraries, tutorials, tools, books, or other external resources).
However, fortunately, shortly after my question was closed, I found a UI library for TikTok Emojis on GitHub called @tiktok-emojis/react, and they even provide a Vue version implementation @tiktok-emojis/vue! They also have an Interactive Demo: The ultimate tool for TikTok emoji codes, meanings, and copy-paste functionality.
In my opinion, for displaying regular emojis in React applications, using Unicode is the simplest approach. However, for those special Emojis (like TikTok's secret emojis), I would prefer to encapsulate them as individual components - similar to lucide-react with type-hinted React components.
The @tiktok-emojis/react library offers exactly what I was looking for:
2.1 Basic Usage Example:
import React from "react";
import { Angel, Happy, Cry, Laugh } from "@tiktok-emojis/react";
export default function App() {
return (
<div>
<Angel size={32} />
<Happy size={48} />
<Cry width={24} height={24} />
<Laugh size="6rem" />
</div>
);
}
Unlike regular Unicode emojis, TikTok's secret emojis use special codes like [smile]
, [happy]
, [angry]
, etc. These only work within the TikTok app itself and aren't standard Unicode characters.
By using a component-based approach like @tiktok-emojis/react, you get:
For React applications:
String.fromCodePoint()
as mentioned in the original answers.This approach gives you the best of both worlds - simplicity for standard emojis and robust component architecture for specialized emoji sets, similar to how lucide-react handles icons.