# j-ListMenu

> A ListMenu component for custom list items. You need to style it.

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

A ListMenu component for custom list items. You need to style it.

__Configuration__:

- `class` {String} CSS class for selected item (default: `selected`)
- `selector` {String} jQuery selector for scope of rendered item (default: `a`)
- `datasource` {String} data-source path (Array)
- `property` {String} Property name for comparing of values (default: `id`)
- `click` {Boolean} enables clicking on items (default: `true`)

Use it with `<ui-component name="listmenu">`. 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
<ui-component name="listmenu" path="listmenu.selected" config="datasource:listmenu.datasource" class="listmenu">
	<script type="text/html">
		{{ if id && id !== '-' }}
			<a href="#">{{ name }}</a>
		{{ else }}
			<hr />
		{{ fi }}
	</script>
</ui-component>

<script>

	var listmenu = {};

	// Default selected item
	listmenu.selected = 4;

	// Data-Source
	listmenu.datasource = [];
	listmenu.datasource.push({ id: 1, name: 'List Item 1' });
	listmenu.datasource.push({ id: '-' });
	listmenu.datasource.push({ id: 2, name: 'List Item 2' });
	listmenu.datasource.push({ id: 3, name: 'List Item 3' });
	listmenu.datasource.push({ id: 4, name: 'List Item 4' });
	listmenu.datasource.push({ id: 5, name: 'List Item 5' });
	listmenu.datasource.push({});
	listmenu.datasource.push({ id: 6, name: 'List Item 6' });
	listmenu.datasource.push({});
	listmenu.datasource.push({ id: 7, name: 'List Item 7' });
	listmenu.datasource.push({ id: 8, name: 'List Item 8' });
	listmenu.datasource.push({ id: 9, name: 'List Item 9' });
	listmenu.datasource.push({ id: 0, name: 'List Item 0' });

</script>
```
