Vue linkify

A simple Vue directive to turn URL's and emails into clickable links

Version: 1.0.1 Updated: 12/15/2016

By: phanan License: MIT

Downloads Last 30 Days: 6.1k


npm i vue-linkify
yarn add vue-linkify





A simple Vue directive to turn URL's and emails into clickable links. Based on SoapBox's Linkify.


This directive can be installed as a module:

$ npm install vue-linkify

or, if you're not in a module environment, just include it as a <script>.

Basic Usage

In a browser environment, you should now have a v-linkified directive set up for free. If you're in a module environment, just import and register it as you please:

import linkify from 'vue-linkify'

Vue.directive('linkified', linkify)

And then you use it away:

  <div id="app">
    <div v-html="raw" v-linkified />
export default {
  data () {
    return {
      raw: 'Hello from'

The above snippet will yield:

Hello from <a href="" class="linkified" target="_blank"></a>

Advanced Slightly Less Basic Usage

You can also pass an options argument, which takes an Object, into the directive to control its behavior. For example, modifying the above template into something like this:

  <div id="app">
    <div v-html="raw" v-linkified:options="{ className: 'foo' }" />

will yield a slightly different HTML:

Hello from <a href="" class="foo" target="_blank"></a>

A list of available options is available here.


MIT © Phan An

Categories: Vue js