Directives
These are the global Vue directives that ship with Navigator, defined in applications/global/front-end/vue/directives/directives.js. They are registered by enCreateApp — its loadLibraries() step calls directives(app) after the EnForms and EnComponents libraries are installed — so every app created through enCreateApp has all of them available with no import in the component.
js
// applications/global/front-end/vue/en-create-app.js
import directives from '@global/vue/directives/directives'
// ...
directives(this.app)An app that calls Vue's createApp directly instead of going through enCreateApp does not get these, and neither do plain (non-Vue) pages.
One directive comes from the component library rather than from this file: v-tooltip, which en-components registers when it is installed with app.use. It is documented with EnTooltip.
v-en-truncate
Shortens the element's text to a character count, appending ... when it was cut. Applied on mount and re-applied whenever the element updates.
vue
<!-- "Employee Navigator Benefits Administration" -> "Employee Navigator Be..." -->
<span v-en-truncate="21">{{ plan.description }}</span>| Binding | Value |
|---|---|
| Value | number — the maximum number of characters to keep |
This rewrites the element's innerText, so the untruncated string is no longer in the DOM — there is no tooltip and nothing for the user to select or copy. When the full value still matters, reach for v-en-css-truncate instead.
v-en-css-truncate
Truncates visually with CSS rather than by rewriting text, and copies the full text into the element's title so it shows on hover. Because the text itself is untouched, this is the safer default of the two.
vue
<!-- single line, clipped at the container's width, full text in the tooltip -->
<td v-en-css-truncate>{{ employee.notes }}</td>
<!-- clamped to 3 lines -->
<td v-en-css-truncate:3>{{ employee.notes }}</td>| Binding | Value |
|---|---|
| Argument | number (optional) — clamp to this many lines. Omit it for a single, non-wrapping line |
| Value | Currently has no effect — see the note below |
With an argument the element becomes a -webkit-box with -webkit-line-clamp, giving a multi-line clamp. Without one it becomes an inline-block with white-space: nowrap, giving the classic single-line ellipsis. On update, only the title is refreshed.
WARNING
The directive accepts a pixel value (v-en-css-truncate="150") and assigns it to max-width, but immediately overwrites that with max-width: 100%, so the value is effectively ignored and truncation always follows the width of the containing element. To cap the width, set it yourself with a class on the element or the column.
v-focus
Focuses an input inside the element once it mounts, for search boxes, modal bodies and other places where the user should be able to start typing right away.
vue
<!-- focuses the last <input> inside the modal body -->
<EnModal v-focus>...</EnModal>
<!-- focuses the first <input> -->
<div v-focus:0>...</div>
<!-- conditionally skip focusing -->
<div v-focus="shouldAutoFocus">...</div>| Binding | Value |
|---|---|
| Argument | number (optional) — index of the input to focus. Defaults to the last input found |
| Value | false skips focusing entirely; anything else (including no value) focuses |
Only input elements are considered — a select, textarea, or contenteditable will not be focused, and nothing happens if the element contains no inputs. It also only runs on mount, so inputs added later are not picked up. If you are unsure which index you want, log the element's querySelectorAll('input') to count them.
v-copy
Copies a string to the clipboard when the element is clicked, via navigator.clipboard.writeText.
vue
<a href="#" v-copy="employee.ssn">Copy SSN</a>| Binding | Value |
|---|---|
| Value | string — the text to write to the clipboard |
Two things to keep in mind:
- The value is captured when the element mounts. The click handler closes over the binding from mount, so a value that changes afterward will still copy the original text. For a value that changes, re-render the element with a different
:key. - No feedback is given — the directive doesn't confirm the copy, so pair it with your own affordance (a toast via
useToaster, or a label change).
The Clipboard API also requires a secure context, which means it works on https and localhost but not over plain http.
v-sanitize
Sets the element's innerHTML to a sanitized version of the bound string, using enSanitizeHtml from the formatters. Applied on mount and on every update.
vue
<!-- renders the markup, minus anything outside the safe whitelist -->
<div v-sanitize="note.bodyHtml"></div>| Binding | Value |
|---|---|
| Value | string — an HTML string from an untrusted or user-authored source |
Use this in place of v-html whenever the markup didn't come from us — user-entered notes, broker-authored content, anything round-tripped through the database. v-html renders whatever it is given, including script tags and inline event handlers; v-sanitize strips everything outside the jitbit sanitizer's tag and attribute whitelist first.