ForgeComponents
en

Components

j-Navigation

jComponent 20 · jcomponent@20 component Example loaded with jComponent 20
  • a simple navigation component like Tree
  • easy for customization
  • supports dark mode

Configuration:

  • exec {String} a link to the function
  • pk {String} a primary key (default: id) for remembering last state of tree

Data-source:

[
	{
		id: 1,
		name: 'Text to navigation item',
		title: 'Optional, a title attribute',
		collapsed: true, // only for children, default "false"
		children: [
			// Can contain same structure as the parent
		]
	}
]

Good to know:

  • only items without children are clickable
  • exec returns an entire object

Use it with <ui-component name="navigation">. 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.

example.html
<div class="row">
	<div class="col-xs-6">
		<div style="border: 1px solid #E0E0E0">
			<ui-component name="navigation" path="items" config="exec:navclick"></ui-component>
		</div>
	</div>
</div>

<script>
	var items = [];
	items.push({ name: 'Home' });
	items.push({ name: 'Admin', collapsed: true, children: [{ name: 'Users' }, { name: 'Products' }] });
	items.push({ name: 'Settings' });

	function navclick(item) {
		console.log(item);
	}
</script>