0.1.4 • Published 4 years ago

form-text-tags v0.1.4

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

form-text-tags

A simple tagged textbox Vue.js component derived from the @odyzeo/form-autocomplete component.

Installation

npm

npm install --save form-text-tags

yarn

yarn add form-text-tags

Import the component where you want to use it and register it:

import 'FormTextTags' from 'form-text-tags';
export default {
  components: {
    FormTextTags,
  },
}

Import styles or make your own.

import 'form-text-tags/dist/form-text-tags.css';

Usage

<template>
  <div
          id="app"
          class="app"
  >
    <div class="container">
      <h1>Demo</h1>

      <p>Adding and removing tags:</p>

      <form-text-tags
              v-model="textBoxTags"
              :close-on-add="false"
              :hide-text-on-blur="false"
              :clear-text-on-blur="false"
              :placeholder="'Add tags here'"
      >
        <template #label>
          Tags
        </template>
      </form-text-tags>

        <p>Textbox value:</p>

        <pre>{{ textBoxTags }}</pre>
    </div>
  </div>
</template>

<script>
  import FormTextTags from '@/components/FormTextTags';

  export default {
    name: 'App',
    components: {
      FormTextTags,
    },
    data() {
      return {
        textBoxTags: [
                "Apple",
                "Orange",
                "Banana",
        ],
      };
    },
  };
</script>

<style lang="less">
  @import '../src/less/app.less';
</style>

Events

Entered

Returns the text of the item entered as a tag

Props

Property nameTypeDefault valueDescription
value or v-modelarray[]Array of initial selected option(s)
placeholderstringInput placeholder attribute
formErrorsarray[]Array of errors to display
blurOnAddbooleanfalseWhether to blur the element after a tag has been added
hideTextOnBlurbooleanfalseWhether to collapse the input area when the element is blurred
clearTextOnBlurbooleanfalseWhether to clear the input area when the element is blurred

Slots

label

Label value for the input element.

prepend

Div block before the input element, use it to display an icon

append

Div block after the input element, use it to display an icon

Development

npm run serve

or

yarn serve
0.1.4

4 years ago

0.1.2

4 years ago

0.1.3

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago