Laravel EnsoLaravel Enso
Guide
Back End
Front End
GitHub
Guide
Back End
Front End
GitHub
  • Front End

    • Accessories
    • Addresses
    • Algolia
    • Audits
    • Auth
    • Bookmarks
    • Calendar
    • Card
    • Cargo Partner
    • Categories
    • Charts
    • Checkbox
    • Clipboard
    • Comments
    • Commercial
    • Companies
    • Confirmation
    • Currencies
    • Data Import
    • Date
    • Datepicker
    • Directives
    • Discounts
    • Divider
    • Documents
    • Dropdown
    • Dropdown Indicator
    • Eav
    • Emag
    • Emails
    • Enums
    • ERD
    • Facebook
    • Files
    • Filters
    • Financials
    • Forms
    • Frisbo
    • Google
    • Holidays
    • How to
    • Interactions
    • Inventory
    • IO
    • Laravel Validation
    • Loader
    • Localisation
    • Logs
    • Measurement Units
    • Meili Search
    • Menus
    • Mixins
    • Modal
    • Money
    • Monitored Emails
    • Notifications
    • Orderable Trees
    • Packaging Units
    • Pagination
    • People
    • Permissions
    • Product Lots
    • Products
    • Progress Bar
    • Progress Circle
    • Progress Indicator
    • Questionnaires
    • Quick View
    • Range Slider
    • Rating
    • Roles
    • Route Mapper
    • Sale Channels
    • Scroll to Top
    • Search Mode
    • Select
    • Sentry
    • Services
    • Smart Bill
    • SMS Advert
    • Strings
    • Switch
    • Tables
    • Tabs
    • Tasks
    • Teams
    • Textarea
    • Themes
    • Ticketing
    • Toastr
    • Transitions
    • Tree View
    • Tutorials
    • Typeahead
    • Typesense
    • UI
    • Uploader
    • UPS
    • User Groups
    • Users
    • Virtual Call Center
    • Vouchers
    • Webshop
    • WYSIWYG

Directives

LicenseStableDownloadsVueJavaScriptnpmIssuesMerge Requests

Description

Vue directives used across Enso UI packages.

Installation

yarn add @enso-ui/directives

Features

  • exports reusable DOM and interaction directives consumed across Enso UI packages
  • supports focus, click-outside, select-on-focus, resize, long-click, and scroll-into-view flows
  • includes a Highlight.js directive for rendered code snippets

Usage

Register the directives you need locally:

import { clickOutside, scrollIntoView } from '@enso-ui/directives';

export default {
    directives: { clickOutside, scrollIntoView },
};

Or register them globally:

import * as directives from '@enso-ui/directives';

Object.entries(directives).forEach(([name, directive]) => {
    app.directive(name, directive);
});

API

v-click-outside

Calls a handler when the click target is outside the bound element.

v-fits-below

Computes whether an element fully fits in the current viewport and passes the result to a callback.

v-focus

Focuses the element after the current tick.

v-hljs

Runs Highlight.js on the first code element inside the bound node.

v-long-click

Runs a handler only after the pointer stays pressed for the configured duration in milliseconds.

v-resize

Auto-resizes an input to its content width. An optional numeric argument sets the minimum width in pixels.

v-scroll-into-view

Calls Element.scrollIntoView() when scroll transitions to true.

v-select-on-focus

Selects the current value when the element receives focus.

Depends On

  • highlight.js

Contributions

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!

License

MIT

Edit this page on GitHub
Last Updated: 4/21/2026, 7:07:07 AM
Prev
Datepicker
Next
Discounts