sidebar
Last updated
Last updated
This UI component displays a sidebar with items on the left side of the screen on desktop and tablets, to indicate to the user how far they are progressing with a process.
Sidebar hidden by default on small screens
By default the sidebar is not shown if the app is used on devices with smaller screens (< 768px). This behavior can be changed in its configuration.
The text contained inside the <sidebar>
tag can be a formatted string, meaning that you can make the text dynamic.
Sidebar Priority
The sidebar must be the first component listed in the View XML.
position
optional
Specifies the position of the sidebar. Can be left
or right
.
Can also be specified by returning a value from a function.
Defaults to left
.
Note that the position of the sidebar will only update after a view transition.
items
optional
Function which returns an array of component.sidebarItem
objects.
Note: If items=
is specified, the sidebar cannot contain any <item>
children.
visible-on-mobile
optional
Boolean indicating whether or not to show the sidebar on mobile. Can be either "true" or "false". Defaults to "false"
state
optional
The way the sidebar item is visually rendered, to indicate to the user whether they have already completed the step indicated by the sidebar item in a process. It can be one of the following:
normal
: The sidebar item is shown normally — should be used for steps in a process that the user has already completed.
active
: The sidebar item is highlighted — should be used to indicate that the user is currently at the step in the process indicated by this sidebar item.
disabled
: The sidebar item text and icon is greyed out — should be used for steps in a process that the user has not yet completed.
In other words, exactly one field should be active
. All fields before it should be normal
, and all fields afterwards should be disabled
.
Defaults to normal
icon
optional
Path of the icon to display on the sidebar item, left of the text. Icons can be uploaded using the Assets workspace in OXIDE.
icon-color
optional
Sets the icon's color. Can be a named color, like primary
or a hex value, like #008000
.
Can also be specified by returning a value from a function.
Return null
to use the icon's default color.
Was added in version 4.36.0 of the JourneyApps Container.
show-if
optional
Controls whether the sidebar item is hidden or shown. The argument specified to show-if
can either be a literal boolean value (true
or false
), or it can specify a variable, parameter or field that can be a string, number, object, etc. that evaluates to false or evaluates to true (see the reference documentation for show-if
and hide-if
for further details)
hide-if
optional
The opposite of show-if
(see above).
on-press
optional
Function to call when the item is pressed - either a JavaScript/TypeScript function or a navigation function.
Note: Adding on-press
to an item
adds a right chevron icon to its right-hand-side.
on-press-icon
optional
The Ionicon to display on the right-hand-side of the item, typically denoting the action.
Defaults to ion-chevron-right
validate
optional
Whether to run field validation before calling the associated on-press
(see above). Can be either true
, false
, or the result of a function, e.g. ($:shouldBeValidated()
).
Version compatibility
The feature to generate sidebars dynamically was introduced in version 4.38.5 of the JourneyApps Container.
The function in items=
must return an array of component.sidebarItem
objects. component.sidebarItem
has the following properties:
Implicit show-if
and hide-if
Note that the items specified above do not have showIf
or hideIf
fields. All items added to the array will automatically be shown. In order to hide an item, omit it from the returned array.