ractive-ez-combobox
v2.0.11
Published
Ractive Ez UI Combobox
Downloads
7
Maintainers
Readme
Ractive Ez ComboBox
ComboBox component for ractive.js
Install
npm i ractive-ez-combobox
import 'ractive-ez-combobox';
import 'ractive-ez-combobox/themes/blue.less';
Usage
Both combobox and multibox support following properties:
items
: List of items to choose fromplaceholder
: Placeholder text if no value is selecteddisabled
: True if input is disabledrequired
: True if input is requiredbutton
: If true, renders a button that shows all items when clickedtypeahead
: True if the input text is automatically suffixed with the full text of the current option. This option should only be used with a prefixfilter
function, and not combined withsearchOnInput
.path
: The item keypath to filter oncompare
: Function(item1, item2) that returns true if the two items are equal. This is used to determine if an item is selected.filter
: Function(text, value) that returns true if the value matches the filter text. The value that is passed to this function is the value of the property atpath
(e.g. if path = "code" then this component will callfilter(text, item.code)
). This function defaults to a prefix filter (that matches at the start of the string).search
: If the items are not known at initialization, you can provide a search function to populate the items asynchronously.function(text, callback) => callback(error, items)
.searchOnInput
: Automatically refresh your items when the user inputs new text (for full asynchronous search).searchDelay
: WhensearchOnInput
is enabled, this value defines the time (in ms) to wait before searching after detecting a keystroke.
The content of the component is the view template of an option.
ComboBox
The combobox selects a single value.
<EzComboBox
value="{{ value }}"
items="{{ countries }}"
path="code">
<b>{{ code }}</b> - {{ name }}
</EzComboBox>
Properties
value
: The item that is currently selected
Events
change(value)
: Dispatched when the value is changed
MultiBox
The multibox selects a list of values.
<EzMultiBox
values="{{ values }}"
items="{{ countries }}"
path="code">
{{ code }} ({{ name }})
</EzMultiBox>
Properties
values
: An array of selected values
Events
change(values)
: Dispatched when the array of selected values changesadd(value)
: Dispatched when a value is added to the list of selected valuesremove(value)
: Dispatched when a value is removed from the list of selected values