Zurb launches new @mention engine, Tribute.js

Paddi Macdonnell.
May 04, 2016
Zurb launches new @mention engine, Tribute.js.

Zurb, makers of Foundation, have a reputation for building robust tools that web developers love. They craft effective solutions because they start out to solve problems they encounter themselves.

Now they’re back with a brand new, open-source, ES6 JavaScript @mention engine called Tribute.js. @mention is a user interface technique for addressing someone directly. When you @mention someone, they are tagged into a conversation. The @mention was first popularized by social media sites like Twitter, but you’ll find it making its way into all manner of applications thanks to adoption by startups like Slack. Back in 2014 Zurb began merging several of their design apps into a single new platform called Notable. They needed an @mention system, but failing to find a reliable 3rd party option, they decided to build their own. The result is Tribute.js. Tribute.js is a native JavaScript solution, meaning that it avoids relying on 3rd party plugins or scripts. By avoiding libraries like jQuery, Angular, and so forth, Zurb decreased the chances of conflicts arising between Tribute.js and scripts that run in conjunction with it; which makes Tribute.js a highly usable tool that can be implemented consistently across a multitude of different applications, regardless of the other dependencies you might choose to use.

How tribute.js works

Tribute.js is really simple to implement. First, import Tribute.js’ CSS and JS:
<link rel="stylesheet" href="tribute.css" />
<script src="tribute.js"></script>
Next, you need an element in your markup that will display a @mention:
<input id="commentField" placeholder="Type your comment">
Lastly, initialize Tribute with an array of objects that represent your users and then attach Tribute to the page element:
<script>
var tribute = new Tribute({
 
 values:[
 {key:"John Doe", value="johndoe"},
 {key:"Jane Doe", value="janedoe"}
 ]
 
});

tribute.attach(document.getElementById("commentField"));
</script>
When a user types an @ symbol, they’ll be presented with a list of usernames based on the key property, when they select one, the corresponding value property will be inserted. You can download Tribute for free from Github, or install via npm, and you’ll find a full list of options in the documentation. Featured image, Conversations via Steve McClanahan.

Paddi MacDonnell

Paddi MacDonnell is a designer and entrepreneur from Northern Ireland, follow her on Twitter.

Read Next

3 Essential Design Trends, December 2023

While we love the holidays, too much of a seasonal theme can get overwhelming. Thankfully, these design trends strike a…

10 Easy Ways to Make Money as a Web Designer

When you’re a web designer, the logical way to make money is designing websites; you can apply for a job at an agency,…

The 10 Most Hated Fonts of All Time

Remember when Comic Sans wasn’t the butt of the jokes? Long for the days when we actually enjoyed using the Impact…

15 Best New Fonts, November 2023

2023 is almost over, and the new fonts are still coming thick and fast. This month, we’ve found some awesome variable…

Old School Web Techniques Best Forgotten

When the web first entered the public consciousness back in the 90s, it was primarily text-based with minimal design…

20 Best New Websites, November 2023

As the nights draw in for the Northern hemisphere, what better way to brighten your day than by soaking up some design…

30 Amazing Chrome Extensions for Designers and Developers

Searching for a tool to make cross-platform design a breeze? Desperate for an extension that helps you figure out the…

Exciting New Tools for Designers, November 2023

We’ve got a mix of handy image helpers, useful design assets, and clever productivity tools, amongst other treats. Some…

The Dangers of Doomscrolling for Designers and How to Break Free

As a creative professional, navigating the digital realm is second nature to you. It’s normal to follow an endless…

From Image Adjustments to AI: Photoshop Through the Years

Remember when Merriam-Webster added Photoshop to the dictionary back in 2008? Want to learn how AI is changing design…

3 Essential Design Trends, November 2023

In the season of giving thanks, we often think of comfort and tradition. These are common themes with each of our three…

30 Obsolete Technologies that will Perplex Post-2000s Kids

Remember the screech of dial-up internet? Hold fond memories of arcade machines? In this list, we’re condensing down 30…