# j-Features

> j-Features: only for desktop computers; singleton

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: 80d4d34e5615578831bf6c9dd696eb7b313fc9e371955e7156ceebdba94922c5
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

- only for desktop computers
- singleton
- works with Bootstrap Grid System

### Methods

Method: `component.open(opt)`

- `opt.placeholder {String}` a placeholder for search input (default: `config.placeholder`)
- `opt.items {Object Array}` with list of features (required):
    - `name {String}` a feature name
    - `icon {String}` (optional) icon without `fa-`
    - `keywords {String}` (optional) additional keywords for searching
    - `value {Object/String/Number}` a value
- `opt.scrolltop {Boolean}` scrolls to top until it's displaying the window (default: `false`)
- `opt.callback(selected) {Function}` a callback which is called when the user performs click for some feature. `selected` argument contains selected item.

Method: `component.hide()`

__Configuration__:

- `placeholder {String}` a placeholder for the search input
- `height {Number}` height of list item (optional, default `35`)

Use it with `<ui-component name="features">`. When the component is not loaded yet, jComponent downloads it on first use from the address in `DEF.fallback` (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

```html example.html
<style>
	body { background-color: #F0F0F0; }
</style>

<ui-component name="features" config="placeholder:Search ..."></ui-component>

<div class="container">
	<a href="javascript:features()">Show features</a>
</div>

<script>
	function features() {
		var opt = {};
		opt.items = [{ name: 'Dashboard' }, { name: 'Invoices' }, { name: 'Orders' }, { name: 'Products' }, { name: 'Pages' }, { name: 'Notes' }, { name: 'Users', icon: 'user' }, { name: 'Settings' }];
		opt.callback = function(selected) {
			console.log('CLICK', selected);
		};
		SETTER('features/show', opt);
	}
	setTimeout(features, 500);
</script>
```
