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

Are Simple Websites Better For Business?

As web design technologies raise the bar on what it is possible to achieve on a realistic budget, there’s a rising deba…

Apple Opts for AR over VR at WWDC

An Apple VR headset has been one of the most widely-rumored devices of the last few years, and it was finally settled a…

Exciting New Tools for Designers, June 2023

We’re halfway through 2023 already, and the number of incredible apps, tools, and resources for designers is mounting.

3 Essential Design Trends, June 2023

This month we are focusing on three trends within a bigger website design trend – different navigation menu styles and …

15 Best New Fonts, May 2023

The choices you make when selecting a typeface have more impact on your design than almost any other decision, so it’s …

10+ Best Tools & Resources for Web Designers and Agencies (2023 updated)

Having the ability to envision a tastefully designed website (i.e., the role creativity plays) is important. But being …

20 Best New Websites, May 2023

This month, there are tons of great new agency websites to get excited about. 3D animated prisms are a popular theme, a…

How to Find the Right White Label Website Builder for Your Agency

Web design agencies face a lot of obstacles in closing the deal with new clients. One of the most common ones is the ar…

Exciting New Tools For Designers, May 2023

There are hundreds of new tools for designers and developers released each month. We sift through them all to bring you…

3 Essential Design Trends, May 2023

All three of the website design trends here mimic something bigger going on in the tech space, from a desire to have mo…

10 Best AI Tools for Web Designers (2023)

It’s time to stop worrying if AI is going to take your job and instead start using AI to expand the services you can of…

10 Best Marketing Agency Websites (Examples, Inspo, and Templates!)

Marketers are skilled in developing strategies, producing visual assets, writing text with high impact, and optimizing …