Emoji Search DIY style is here, on our latest tutorial, how to guide. Learn how to create a Chrome extension that lets users search for emojis and copy them effortlessly. This beginner-friendly guide covers everything from setup to advanced features like dark mode. Build and enjoy your own custom extension today!
Table of Contents
Introduction
Have you ever needed a quick way to search for emojis and copy them to your clipboard? In this tutorial, I’ll show you how to create a Chrome extension that lets you:
- Search for emojis by keywords.
- Copy emojis to your clipboard with one click.
This guide is perfect for beginners and only requires basic HTML, CSS, and JavaScript skills. Let’s get started!
Step 1: Set Up Your Project Folder
Create a new folder on your computer. Name it something like emoji_search_extension.
Inside the folder, create three essential files:
popup.html— The HTML page for the extension popup.script.js— The JavaScript file to add functionality.manifest.json— The configuration file for your Chrome extension.
Step 2: Write the HTML for the Extension
Open the popup.html file and paste the following code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Emoji Search and Copy</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f9f9f9;
min-width: 400px;
min-height: 600px;
}
h1 {
text-align: center;
}
input {
width: 80%;
max-width: 300px;
margin: 0 auto 10px auto;
display: block;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 16px;
}
#results {
display: flex;
flex-wrap: wrap;
gap: 10px;
justify-content: center;
}
.emoji-card {
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
cursor: pointer;
text-align: center;
font-size: 24px;
background-color: #fff;
transition: transform 0.2s ease;
}
.emoji-card:hover {
transform: scale(1.1);
background-color: #e6f7ff;
}
</style>
<script src="script.js" defer></script>
</head>
<body>
<h1>Emoji Search and Copy Tool</h1>
<input type="text" id="search" placeholder="Search for an emoji...">
<div id="results"></div>
</body>
</html>
What This Does:
- Sets up a simple layout with a search bar.
- Displays emojis as cards that can be clicked.
Step 3: Add JavaScript for Search and Copy
Now create the script.js file in the same folder and add the following code:
document.addEventListener("DOMContentLoaded", () => {
const emojiData = `😂 Face with tears of joy
😄 Smiling Face with Open Mouth and Smiling Eyes
😃 Smiling Face with Open Mouth
😀 Grinning Face
😊 Smiling Face with Smiling Eyes`;
const emojis = emojiData.split("\n").map(line => {
const parts = line.split(" ");
return { emoji: parts[0], text: parts.slice(1).join(" ") };
});
const resultsContainer = document.getElementById("results");
const searchInput = document.getElementById("search");
function displayEmojis(filteredEmojis) {
resultsContainer.innerHTML = "";
filteredEmojis.forEach(item => {
const emojiCard = document.createElement("div");
emojiCard.className = "emoji-card";
emojiCard.textContent = item.emoji;
emojiCard.title = item.text;
emojiCard.onclick = () => copyToClipboard(item.emoji);
resultsContainer.appendChild(emojiCard);
});
}
function searchEmoji() {
const query = searchInput.value.toLowerCase();
const filteredEmojis = emojis.filter(item =>
item.text.toLowerCase().includes(query)
);
displayEmojis(filteredEmojis);
}
function copyToClipboard(emoji) {
navigator.clipboard.writeText(emoji).then(() => {
alert(`Copied: ${emoji}`);
});
}
searchInput.addEventListener("input", searchEmoji);
displayEmojis(emojis);
});
Step 4: Add the Manifest File
The manifest.json file tells Chrome how to load your extension. Create the file and paste the following:
{
"manifest_version": 3,
"name": "Emoji Search and Copy Tool",
"version": "1.0",
"description": "Search for emojis and copy them to your clipboard.",
"action": {
"default_popup": "popup.html",
"default_title": "Emoji Search"
},
"permissions": ["clipboardWrite"],
"icons": {
"16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png"
}
}
Step 5: Load Your Extension into Chrome
- Open Chrome and go to
chrome://extensions/. - Enable Developer Mode (toggle in the top-right corner).
- Click Load unpacked and select your project folder.
Your extension will now appear in the list and can be pinned to the toolbar.
Step 6: Test Your Extension
- Click the Emoji Search Tool icon in the Chrome toolbar.
- Use the search bar to find emojis by keywords.
- Click on an emoji to copy it to your clipboard.
Troubleshooting Tips
-
Inline Script Errors:
If you encounterContent Security Policyerrors for inline scripts, ensure you’re using a separatescript.jsfile with thedeferattribute. -
Clipboard Not Working:
Ensure that theclipboardWritepermission is specified inmanifest.json. Chrome will prompt you to allow clipboard access. -
Layout Issues:
If your popup content is overflowing, ensure your CSS sets amin-widthandmin-heightto make the popup responsive.
Customization Ideas
-
More Emojis:
Expand the emoji list by adding more emojis to theemojiDatavariable inscript.js. -
Categories:
Add buttons or dropdowns to filter emojis into categories like “Smileys”, “Animals”, or “Symbols”. -
Dark Mode:
Add a toggle to switch between light and dark themes. -
Improved UI:
Use a modern UI framework like Bootstrap or Tailwind CSS to style the popup more professionally. -
Keyboard Shortcuts:
Allow users to navigate emojis using arrow keys and select with Enter.
Conclusion
Congratulations! 🎉 You’ve built a simple yet powerful Chrome extension that can search for emojis and copy them to your clipboard. This extension can be customized further with more features like emoji categories or advanced styling.
If you enjoyed this tutorial, share it with your friends or leave a comment. Let me know if you’d like more tutorials on building Chrome extensions!
Digital Designer, blog writer and also a tech enthusiast.
He loves to write content for blogs, podcasts, design websites, logos, brochures, banners and anything that sends a message to an audience.
You can contact Daniele at the link below:



