/ui/elements/pills

Exports the pills(component) method as mapp.ui.elements.pills() to create a pills ui component.

Methods

(inner) add(val)

Adds a pill with the provided value to the pill component (this) and executes the component.addCallback() method if declared.

Parameters:
NameTypeDescription
valstring

The pill value.

(inner) pills(component) → {Object}

Decorates the component object with add() and remove() methods before returning the component.

Parameters:
NameTypeDescription
componentObject

The component object to be decorated.

Properties
NameTypeAttributesDescription
component.targetHTMLElement

The target element to append to.

component.pillsObject<optional>

array of values to be initially selected

component.addCallbackfunction<optional>

Function to execute once a pill has been added. Takes as arguments added value and array of selected values.

component.removeCallbackfunction<optional>

Function to execute once a pill has been removed. Takes as arguments removed value and array of selected values.

Returns:

The decorated component object.

Type: 
Object

(inner) remove(val)

Removes a pill with the provided value to the pill component (this) and executes the component.removeCallback() method if declared.

Parameters:
NameTypeDescription
valstring

The pill value.