JSPM

@clampy-js/vue-clampy

1.0.6
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Score
    100M100P100Q106224F
  • License MIT

Vue.js (2+) directive that clamps the content of an element by adding an ellipsis to it if the content inside is too long.

Package Exports

  • @clampy-js/vue-clampy

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@clampy-js/vue-clampy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

vue-clampy

Build Status GitHub issues GitHub license npm

Vue.js (2+) directive that clamps the content of an element by adding an ellipsis to it if the content inside is too long.

It uses @clampy-js/clampy library (a fork of Clamp.js) behind the scene to apply the ellipsis.

It automatically re-clamps itself when the element or the browser window change size.

Installation

You can install @clampy-js/vue-clampy using NPM or Yarn:

npm install @clampy-js/vue-clampy
yarn install @clampy-js/vue-clampy

Usage

<script>
import clampy from '@clampy-js/vue-clampy';
import Vue from 'vue';

Vue.use(clampy);

export default {
  name: 'app',
  directives: {
    clampy
  }
};
</script>
<template>
  <p v-clampy="3">Long text to clamp here</p>
</template>  

Options

You can also override default options globally:

Vue.use(clampy, {
  truncationChar: '✂️'
});