# j-TabMenu

> j-TabMenu options: class, selector, datasource, disabled, exec, attr

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

__Configuration__:

- `class {String}` optional, is a class name for a selected element (default: `selected`)
- `selector {String}` optional, is a jQuery selector (default: `li`)
- `datasource {String}` optional, a path to a data-source, content must be Tangular template
- `disabled {Boolean}` optional, it can disable tabs
- `exec {String}` optional, a link to the function (it will be executed when the tab is changed)
- `attr {String}` optional, a default attribute for obtaining tab identifier (default: `id`)

Use it with `<ui-component name="tabmenu">`. 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
<h2>Static tabs</h2>

<ui-component name="tabmenu" path="tab">
	<ul>
		<li data-id="tab1">Tab 1</li>
		<li data-id="tab2">Tab 2</li>
		<li data-id="tab3">Tab 3</li>
	</ul>
</ui-component>

<ui-bind path="tab" config="show:value==='tab1'" class="block hidden">
	TAB 1 content
</ui-bind>
<ui-bind path="tab" config="show:value==='tab2'" class="block hidden">
	TAB 2 content
</ui-bind>
<ui-bind path="tab" config="show:value==='tab3'" class="block hidden">
	TAB 3 content
</ui-bind>

<br />

<h2>Dynamic tabs</h2>
<ui-component name="tabmenu" path="tab" config="datasource:tabs">
	<script type="text/html">
		<ul>
			{{ foreach m in value }}
			<li data-id="{{ m.id }}">{{ m.name }}</li>
			{{ end }}
		</ul>
	</script>
</ui-component>

<ui-bind path="tab" config="show:value==='tab1'" class="block hidden">
	Dynamic TAB 1 content
</ui-bind>
<ui-bind path="tab" config="show:value==='tab2'" class="block hidden">
	Dynamic TAB 2 content
</ui-bind>
<ui-bind path="tab" config="show:value==='tab3'" class="block hidden">
	Dynamic TAB 3 content
</ui-bind>

<script>
	var tab = 'tab1';
	var tabs = [{ name: 'Tab 1', id: 'tab1' }, { name: 'Tab2', id: 'tab2' }, { name: 'Tab 3', id: 'tab3' }];
</script>
```
