« Tag Picker Sort 1.0.0

This extension lets you sort the tag items both programmatically and manually by dragging them into the desired order.

Usage

Browser

<script src="./tag-picker/index.min.js"></script>
<script src="./tag-picker.sort/index.min.js"></script>
<script>
  const picker = new TagPicker(document.querySelector('input'), {
      with: [TagPicker.Sort]
  });
</script>

Node.js

CommonJS

const TagPicker = require('@taufik-nurrohman/tag-picker').default;
const TagPickerSort = require('@taufik-nurrohman/tag-picker.sort').default;

const picker = new TagPicker(document.querySelector('input'), {
    with: [TagPickerSort]
});

ECMAScript

import TagPicker from '@taufik-nurrohman/tag-picker';
import TagPickerSort from '@taufik-nurrohman/tag-picker.sort';

const picker = new TagPicker(document.querySelector('input'), {
    with: [TagPickerSort]
});

Methods

Instance Methods

picker.reverse()

Reverses the order of the current tag items.

picker.reverse();

picker.sort(method)

Sorts the current tag items in alphabetical order (by default).

picker.sort();
picker.sort((a, b) => {
    return a.localeCompare(b, undefined, {
        numeric: true,
        sensitivity: 'base'
    });
});