item
Last updated
Last updated
Items are destinations that users can navigate to. An item is associated with a single view in your app. When a user clicks on an item, they will be navigated to its associated view automatically.
The hamburger icon is present on any view that has an associated item the navigation drawer.
An item can be a parent or a child. Parent items can be set to be collapsable, in which case a caret will display next to the item that will show and hide its children on toggle.
An icon can be specified for an item, and will be placed on the left of its text.
item
best practices
Naming a view
View names should be:
short and concise
devoid of action words (e.g. use "Sites" instead of "View sites")
Collapsible items
When deciding whether parent items with children should be collapsable or not - have a look at the amount of content in the navigation drawer as a whole. If it contains a lot of items, make parent items collapsable so that all/most parent items are visible without scrolling. If the drawer is fairly empty, and most children items are visible without scrolling, don’t make parent items collapsible.
label
<item label="{$:getSiteName()}: Summary"/>
validate
<item label="User details" view="user/details" validate="true">
Optional
Default: false
Validation will check all required fields on the view and confirm that they contain values. In the case validation fails, the user cannot navigate to another item on the navigation drawer.
view
<item view="users">
The view
attribute ties a destination to a particular view path. The user will be navigated to that view.
args
<item args="$:buildItemArgs()">
In the case where the view being navigated to expects view parameters, we pass arguments using args=$:function()
. The $:function()
should return an array of values that match the number and type of the expected view parameters.
Example: The view with view path site
expects two parameters, the current user and the current site.
collapsable
<item collapsable="true"/>
Default: false
Specify that the parent item should be collapsable.
collapsable
best practices
When deciding whether parent items with children should be collapsable or not - have a look at the amount of content in the navigation drawer as a whole. If it contains a lot of items, make parent items collapsable so that all/most parent items are visible without scrolling. If the drawer is fairly empty, and most children items are visible without scrolling, don’t make parent items collapsible.
from-js
<item from-js="$:buildItemFromJS">
Construct a navigation item from JavaScript/TypeScript, using a $:function()
that returns an array of component.navigationItem
objects.
id
<item id="{$:getItemId()}"/>
Type: Format string
Default: unset
icon
<item icon="fa-bomb">
Specify an icon for a navigation item. String representing a font-awesome, ionicon or png icon.
icon-color
indicator
items
<item items="$:buildItems()"/>
Construct a parent item's items from JavaScript/TypeScript using a function that returns an object array of type navigationItem
.
show-if
and hide-if
Provide a label for a navigation item. Can be a static string, a or a .
In the case where multiple items reference the same view path, please see the reference on how to manually set the active item.
The id
attribute is used to target the item
when triggering a component method. See for more detail.
Specify a color for an item
's using icon-color="my-named-color"
. Supports named colors and #HEX values.
See