All Projects → calvinlough → ember-tag-input

calvinlough / ember-tag-input

Licence: MIT license
Simple Ember addon for entering tags

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
Handlebars
879 projects
CSS
56736 projects

Projects that are alternatives of or similar to ember-tag-input

tag-picker
Better tags input interaction with JavaScript.
Stars: ✭ 27 (+50%)
Mutual labels:  input, tag
React Native Segmented Text Input
A wickedly customizable <TextInput /> for React Native. Useful for tags, spellchecking, whatever.
Stars: ✭ 104 (+477.78%)
Mutual labels:  input, tag
Tags Input
🔖 <input type="tags"> like magic
Stars: ✭ 312 (+1633.33%)
Mutual labels:  input, tag
ember-best-language
🏳 A FastBoot-enabled addon to detect the best language for your user.
Stars: ✭ 18 (+0%)
Mutual labels:  emberjs, addon
React Input Tags
React component for tagging inputs.
Stars: ✭ 10 (-44.44%)
Mutual labels:  input, tag
Ember Cli Typescript
Use TypeScript in your Ember.js apps!
Stars: ✭ 346 (+1822.22%)
Mutual labels:  emberjs, addon
angular-datetime-inputs
📅 Angular directives for datetime inputs
Stars: ✭ 20 (+11.11%)
Mutual labels:  input
input-mask
🎭 @ngneat/input-mask is an angular library that creates an input mask
Stars: ✭ 174 (+866.67%)
Mutual labels:  input
liu
💫 Boshiamy Input Method in macOS 嘸蝦米輸入法
Stars: ✭ 39 (+116.67%)
Mutual labels:  input
HexTags
Customize tags & chat colors!
Stars: ✭ 53 (+194.44%)
Mutual labels:  tag
ember-await
Await component for Ember Applications. Resolve your data on demand, just when needed.
Stars: ✭ 54 (+200%)
Mutual labels:  emberjs
storybook-chapters
React Storybook Addon for Hierarchical Substories (Chapters)
Stars: ✭ 46 (+155.56%)
Mutual labels:  addon
VJ-Base
An addon for Garry's mod that contains bunch of bases to make many different types of addons.
Stars: ✭ 57 (+216.67%)
Mutual labels:  addon
trello-super-powers
Repository of the Firefox add-on. (https://addons.mozilla.org/en-US/firefox/addon/trello-super-powers/)
Stars: ✭ 29 (+61.11%)
Mutual labels:  addon
request-parser
Small PHP Library for type-safe input handling
Stars: ✭ 53 (+194.44%)
Mutual labels:  input
CockpitCMS-Helpers
Cockpit CMS Addon with a set of useful helpers (that alone don't justify a new Addon).
Stars: ✭ 39 (+116.67%)
Mutual labels:  addon
ember-vertical-timeline
A Vertical Timeline for Ember.js apps 🚀
Stars: ✭ 19 (+5.56%)
Mutual labels:  addon
snoozz-tab-snoozing
A Web Extension to declutter windows by snoozing tabs for later
Stars: ✭ 105 (+483.33%)
Mutual labels:  addon
pwb-for-heroku
A Rails website using the property-web-builder gem and ready to be deployed to heroku
Stars: ✭ 19 (+5.56%)
Mutual labels:  emberjs
windows-chewing-tsf-build
Windows新酷音 非官方編譯
Stars: ✭ 98 (+444.44%)
Mutual labels:  input

ember-tag-input

ember-tag-input is a simple Ember addon that converts a user's typing into tags. New tags are created when the user types a comma, space, or hits the enter key. Tags can be removed using the backspace key or by clicking the x button on each tag.

Usage

In the simplest case, just pass a list of tags to render and actions for adding and removing tags. The component will never change the tags list for you, it will instead call actions when changes need to be made. The component will yield each tag in the list, allowing you to render it as you wish.

<TagInput
  @tags={{this.tags}}
  @addTag={{this.addTag}}
  @removeTagAtIndex={{this.removeTagAtIndex}}
  as |tag|
>
  {{tag}}
</TagInput>
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';

export default class ApplicationController extends Controller {
  @tracked tags = [];

  @action addTag(tag) {
    this.tags.pushObject(tag);
  }

  @action removeTagAtIndex(index) {
    this.tags.removeAt(index);
  }
}

The above example works if your tags array is just an simple array of strings. If your tags are more complex objects, you can render them however you want, as demonstrated by the following example:

<TagInput
  @tags={{this.tags}}
  @addTag={{this.addTag}}
  @removeTagAtIndex={{this.removeTagAtIndex}}
  as |tag|
>
  <div class="tagInput-name">
    {{tag.name}}
  </div>
  <div class="tagInput-date">
    {{tag.date}}
  </div>
</TagInput>

If you pass tags objects, you can use the modifiers property to pass extra classes to individual tags:

tags = A([
  { name: 'first', modifiers: 'primaryTag' },
  { name: 'second', modifiers: 'secondaryTag' },
]);

Options

tags

  • An array of tags to render.
  • default: null

removeConfirmation

  • Whether or not it takes two presses of the backspace key to remove a tag. When enabled, the first backspace press will add the class emberTagInput-tag--remove to the element that is about to be removed.
  • default: true

allowCommaInTags

  • If tags are allowed to contain comma.
  • default: false

allowSpacesInTags

  • If tags are allowed to contain spaces.
  • default: false

allowDuplicates

  • If duplicates tags are allowed in the list.
  • default: false

showRemoveButtons

  • If 'x' removal links should be displayed at the right side of each tag.
  • default: true

placeholder

  • The placeholder text to display when the user hasn't typed anything. Isn't displayed if readOnly=true.
  • default: ''

ariaLabel

  • The aria-label for the input field.
  • default: ''

readOnly

  • If a read only view of the tags should be displayed. If enabled, existing tags can't be removed and new tags can't be added.
  • default: false

maxlength

  • If maxlength value is passed in, each <input> field(tag) will have maximum number of characters allowed.
  • default: ''

Actions

addTag

  • This action will get called when the user is trying to add a new tag. Your implementation should either add the tag to the tags array or return false if the tag wasn't added.
  • parameters: tag

removeTagAtIndex

  • This action will get called when the user is trying to remove a tag. Your implementation should remove the element from the tags array at the specified index.
  • parameters: index

onKeyUp

  • This action will get called after each key press.
  • parameters: currentInputValue
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].