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

20 Best New Websites, May 2024

Welcome to May’s compilation of the best sites on the web. This month we’re focused on color for younger humans,…

Exciting New Tools for Designers, May 2024

This year, we’ve seen a wave of groundbreaking apps and tools. AI is reshaping the industry, enhancing productivity,…

Using AI to Predict Design Trends

Design trends evolve at a blistering pace, especially in web design. On multi-month projects, you might work on a…

15 Best New Fonts, April 2024

Just like web design, type design follows trends. And while there’s always room for an exciting outsider, we tend to…

3 Essential Design Trends, May 2024

Integrated navigation elements, interactive typography, and digital overprints are three website design trends making…

How to Write World-Beating Web Content

Writing for the web is different from all other formats. We typically do not read to any real depth on the web; we…

20 Best New Websites, April 2024

Welcome to our sites of the month for April. With some websites, the details make all the difference, while in others,…

Exciting New Tools for Designers, April 2024

Welcome to our April tools collection. There are no practical jokes here, just practical gadgets, services, and apps to…

How Web Designers Can Stay Relevant in the Age of AI

The digital landscape is evolving rapidly. With the advent of AI, every sector is witnessing a revolution, including…

14 Top UX Tools for Designers in 2024

User Experience (UX) is one of the most important fields of design, so it should come as no surprise that there are a…

What Negative Effects Does a Bad Website Design Have On My Business?

Consumer expectations for a responsive, immersive, and visually appealing website experience have never been higher. In…

10+ Best Resources & Tools for Web Designers (2024 update)

Is searching for the best web design tools to suit your needs akin to having a recurring bad dream? Does each…