---
title: "Custom directives and plugins · vuejs.school"
description: "Reuse low-level DOM work with a custom directive, and set up app-wide features once with a plugin and app.use()."
canonical_url: "https://vuejs.school/learn/advanced/custom-directives-and-plugins"
meta:
  "og:description": "Reuse low-level DOM work with a custom directive, and set up app-wide features once with a plugin and app.use()."
  "og:image": "https://vuejs.school/_og/d/a_~Q3VzdG9tIGRpcmVjdGl2ZXMgYW5kIHBsdWdpbnMgwrcgdnVlanMuc2Nob29s%2Cc_OgCard.takumi%2Ctitle_Custom%2Bdirectives%2Band%2Bplugins%2Cdescription_~UmV1c2UgbG93LWxldmVsIERPTSB3b3JrIHdpdGggYSBjdXN0b20gZGlyZWN0aXZlLCBhbmQgc2V0IHVwIGFwcC13aWRlIGZlYXR1cmVzIG9uY2Ugd2l0aCBhIHBsdWdpbiBhbmQgYXBwLnVzZSgpLg%2Ceyebrow_~QWR2YW5jZWQgVnVlIMK3IExlc3NvbiA1IG9mIDEx%2Ctint_lilac%2Cp_Ii9sZWFybi9hZHZhbmNlZC9jdXN0b20tZGlyZWN0aXZlcy1hbmQtcGx1Z2lucyI%2Cs_HhV8ETYq3FdE6F9S.png"
  "og:image:alt": "Custom directives and plugins · vuejs.school"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Custom directives and plugins · vuejs.school"
  "twitter:image": "https://vuejs.school/_og/d/a_~Q3VzdG9tIGRpcmVjdGl2ZXMgYW5kIHBsdWdpbnMgwrcgdnVlanMuc2Nob29s%2Cc_OgCard.takumi%2Ctitle_Custom%2Bdirectives%2Band%2Bplugins%2Cdescription_~UmV1c2UgbG93LWxldmVsIERPTSB3b3JrIHdpdGggYSBjdXN0b20gZGlyZWN0aXZlLCBhbmQgc2V0IHVwIGFwcC13aWRlIGZlYXR1cmVzIG9uY2Ugd2l0aCBhIHBsdWdpbiBhbmQgYXBwLnVzZSgpLg%2Ceyebrow_~QWR2YW5jZWQgVnVlIMK3IExlc3NvbiA1IG9mIDEx%2Ctint_lilac%2Cp_Ii9sZWFybi9hZHZhbmNlZC9jdXN0b20tZGlyZWN0aXZlcy1hbmQtcGx1Z2lucyI%2Cs_HhV8ETYq3FdE6F9S.png"
  "twitter:image:alt": "Custom directives and plugins · vuejs.school"
---

> Index of every page on this site: [llms.txt](https://vuejs.school/llms.txt)

# **Custom directives and plugins**

Reuse low-level DOM work with a custom directive, and set up app-wide features once with a plugin and app.use().

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://vuejs.school/#website","@type":"WebSite","description":"A free AI-instructed school for Vue.js. Short tutorials, runnable code and quizzes that adapt to you.","name":"vuejs.school","url":"https://vuejs.school/","publisher":{"@id":"https://vuejs.school/#identity"}},{"@id":"https://vuejs.school/learn/advanced/custom-directives-and-plugins#webpage","@type":"WebPage","description":"Reuse low-level DOM work with a custom directive, and set up app-wide features once with a plugin and app.use().","name":"Custom directives and plugins","url":"https://vuejs.school/learn/advanced/custom-directives-and-plugins","breadcrumb":{"@id":"https://vuejs.school/learn/advanced/custom-directives-and-plugins#breadcrumb"},"isPartOf":{"@id":"https://vuejs.school/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://vuejs.school/learn/advanced/custom-directives-and-plugins"]}],"primaryImageOfPage":{"@id":"https://vuejs.school/#logo"}},{"@id":"https://vuejs.school/#identity","@type":"Organization","description":"A free AI-instructed school for Vue.js. Short tutorials, runnable code and quizzes that adapt to you.","name":"vuejs.school","url":"https://vuejs.school","logo":{"@id":"https://vuejs.school/#logo"}},{"@id":"https://vuejs.school/learn/advanced/custom-directives-and-plugins#article","description":"Reuse low-level DOM work with a custom directive, and set up app-wide features once with a plugin and app.use().","headline":"Custom directives and plugins","inLanguage":"en","isAccessibleForFree":true,"thumbnailUrl":"https://vuejs.school/_og/d/a_~Q3VzdG9tIGRpcmVjdGl2ZXMgYW5kIHBsdWdpbnMgwrcgdnVlanMuc2Nob29s%2Cc_OgCard.takumi%2Ctitle_Custom%2Bdirectives%2Band%2Bplugins%2Cdescription_~UmV1c2UgbG93LWxldmVsIERPTSB3b3JrIHdpdGggYSBjdXN0b20gZGlyZWN0aXZlLCBhbmQgc2V0IHVwIGFwcC13aWRlIGZlYXR1cmVzIG9uY2Ugd2l0aCBhIHBsdWdpbiBhbmQgYXBwLnVzZSgpLg%2Ceyebrow_~QWR2YW5jZWQgVnVlIMK3IExlc3NvbiA1IG9mIDEx%2Ctint_lilac%2Cp_Ii9sZWFybi9hZHZhbmNlZC9jdXN0b20tZGlyZWN0aXZlcy1hbmQtcGx1Z2lucyI%2Cs_HhV8ETYq3FdE6F9S.png","@type":["Article","TechArticle"],"articleSection":["Components"],"author":{"@id":"https://vuejs.school/#identity"},"image":{"@id":"https://vuejs.school/#/schema/image/1"},"isPartOf":{"@id":"https://vuejs.school/learn/advanced/custom-directives-and-plugins#webpage"},"keywords":["custom directives","directive hooks","app.use()","install()","app.provide()"],"mainEntityOfPage":{"@id":"https://vuejs.school/learn/advanced/custom-directives-and-plugins#webpage"},"publisher":{"@id":"https://vuejs.school/#identity"}},{"@id":"https://vuejs.school/learn/advanced/custom-directives-and-plugins#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Skill tree","item":"https://vuejs.school/track","position":1},{"@type":"ListItem","name":"Advanced Vue","item":"https://vuejs.school/track/advanced","position":2},{"@type":"ListItem","name":"Custom directives and plugins","position":3}]},{"@id":"https://vuejs.school/#logo","@type":"ImageObject","caption":"vuejs.school","contentUrl":"https://vuejs.school/apple-touch-icon.png","inLanguage":"en","url":"https://vuejs.school/apple-touch-icon.png"},{"@id":"https://vuejs.school/#/schema/image/1","@type":"ImageObject","contentUrl":"https://vuejs.school/_og/d/a_~Q3VzdG9tIGRpcmVjdGl2ZXMgYW5kIHBsdWdpbnMgwrcgdnVlanMuc2Nob29s%2Cc_OgCard.takumi%2Ctitle_Custom%2Bdirectives%2Band%2Bplugins%2Cdescription_~UmV1c2UgbG93LWxldmVsIERPTSB3b3JrIHdpdGggYSBjdXN0b20gZGlyZWN0aXZlLCBhbmQgc2V0IHVwIGFwcC13aWRlIGZlYXR1cmVzIG9uY2Ugd2l0aCBhIHBsdWdpbiBhbmQgYXBwLnVzZSgpLg%2Ceyebrow_~QWR2YW5jZWQgVnVlIMK3IExlc3NvbiA1IG9mIDEx%2Ctint_lilac%2Cp_Ii9sZWFybi9hZHZhbmNlZC9jdXN0b20tZGlyZWN0aXZlcy1hbmQtcGx1Z2lucyI%2Cs_HhV8ETYq3FdE6F9S.png","inLanguage":"en","url":"https://vuejs.school/_og/d/a_~Q3VzdG9tIGRpcmVjdGl2ZXMgYW5kIHBsdWdpbnMgwrcgdnVlanMuc2Nob29s%2Cc_OgCard.takumi%2Ctitle_Custom%2Bdirectives%2Band%2Bplugins%2Cdescription_~UmV1c2UgbG93LWxldmVsIERPTSB3b3JrIHdpdGggYSBjdXN0b20gZGlyZWN0aXZlLCBhbmQgc2V0IHVwIGFwcC13aWRlIGZlYXR1cmVzIG9uY2Ugd2l0aCBhIHBsdWdpbiBhbmQgYXBwLnVzZSgpLg%2Ceyebrow_~QWR2YW5jZWQgVnVlIMK3IExlc3NvbiA1IG9mIDEx%2Ctint_lilac%2Cp_Ii9sZWFybi9hZHZhbmNlZC9jdXN0b20tZGlyZWN0aXZlcy1hbmQtcGx1Z2lucyI%2Cs_HhV8ETYq3FdE6F9S.png"}]}
```