Custom directives let you manipulate the DOM directly which is useful when built-in directives (like v-bind, v-show) aren’t enough.
They help you encapsulate reusable DOM-level logic (e.g. auto-focus an input, custom scroll behavior, permission-based UI tweaks) rather than repeating code in many components.
You can register them globally (available everywhere) or locally inside a component.
“Permission-Based Access Control in Vue Using JWT, Directives & Route Guards” — it shows a real-world example of using a custom directive (v-permission) to control UI based on permissions.


.png)
