> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/projects/flow-components/get-started/building-left-side-vertical-navigation.md).

# Building Left-Side Vertical Navigation

## Overview <a href="#overview" id="overview"></a>

This tutorial will walk you through creating a left-side vertical navigation menu for your app using the Avonni Navigation component. You'll learn key concepts, best practices, and helpful tips to improve your app's overall user experience.

**By the end of this tutorial, you'll be able to**

* Confidently build intuitive and user-friendly left-side navigation menus
* Understand how to use Avonni Flow Screen Components effectively

## **Here's what we'll cover**

1. **Create Reusable Navigation Items:** We'll use Avonni's "Navigation Item Collection" tool to define global navigation items that can be used throughout your app. This saves development time and ensures a more consistent interface.
2. **Set Up Navigation Logic:** We'll add a "router" to control the screen shown when a user clicks on a navigation item.
3. **Build the Screens:** We'll create the screens for each navigation item and connect them to the left-menu navigation component. This maintains the look and feel of your app's unified appearance.
4. **The final step will be revealed later in the tutorial.** (Keep reading to find out!)

<figure><img src="https://docs.avonnicomponents.com/~gitbook/image?url=https%3A%2F%2F27923732-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F1FUd4apB9YHgCEMUFbVb%252Fuploads%252FD9P4SLaKVADaHmi6XksR%252F2023-05-01_21-11-10.jpg%3Falt%3Dmedia%26token%3D7c223dfc-3915-4a16-991d-0a04e80c1c2d&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=5c93e67f&#x26;sv=2" alt=""><figcaption><p>Screen Flow overview architecture</p></figcaption></figure>

## Final Result <a href="#final-result" id="final-result"></a>

<figure><img src="https://docs.avonnicomponents.com/~gitbook/image?url=https%3A%2F%2F27923732-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F1FUd4apB9YHgCEMUFbVb%252Fuploads%252FbfZ1rTBeuwNekRrb9iQ8%252F2023-06-13_11-01-17%2520%281%29.gif%3Falt%3Dmedia%26token%3De615c2d6-b6dc-41b8-a251-6b4f9ef1700b&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=b3fe2ec4&#x26;sv=2" alt=""><figcaption></figcaption></figure>

## Guided Steps <a href="#steps" id="steps"></a>

{% stepper %}
{% step %}

### Define global navigation items <a href="#id-1-define-global-navigation-items" id="id-1-define-global-navigation-items"></a>

To start, we’ll create a centralized list of navigation items for your side menu. This step is essential because it enables you to manage all your menu options in one place, ensuring consistent navigation and making updates easy as your app grows. By defining these items at the beginning of your Flow, you ensure that every screen in your app references the same collection, saving time and reducing errors from duplicate or mismatched menus.

1. **Add an Action Element:** On your Flow canvas, add an **Action** element.
2. **Find the Avonni Action:** In the "Category" list, choose **Avonni**, then select **Navigation Item Collection** as the Action.
3. **Name and Add Items:**
   * Give the action a clear **Label** (e.g., "Define Main Navigation").
   * Under **Navigation Items**, click **Add Item** for each menu option you want. For each item, provide a **Label** (what the user sees, e.g., "Welcome") and a **Name** (a unique API-style name, e.g., `welcome`).
4. **Store the Output:**
   * Go to the **Advanced** section and check **Manually assign variables**.
   * Under "Store Output Values," create a **New Resource**.
   * **Resource Type:** `Variable`
   * **API Name:** `navigationItems`
   * **Data Type:** `Apex-Defined`
   * Select the box labeled '**Allow multiple values (collection)**'.
   * **Apex Class:** Select `avcmpbuilder__NavigationItem`.
   * Click **Done**. You've now created a collection variable (`navigationItems`) that holds all your menu item data.

<figure><img src="https://docs.avonnicomponents.com/~gitbook/image?url=https%3A%2F%2F27923732-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F1FUd4apB9YHgCEMUFbVb%252Fuploads%252FrvBdQF5UAFcGMxHaw60x%252F2023-05-30_14-52-20.png%3Falt%3Dmedia%26token%3D75ba1551-7568-44b6-9c03-ad2d15e97520&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=5db1f9c7&#x26;sv=2" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Create a Variable to Track the Active Screen

Next, we need to set up a variable that tracks which screen the user is currently viewing. This variable acts as the “state” of your navigation, letting the Flow know which section to display at any given time.

1. **Create a New Resource:** In the Flow's toolbox, create a **New Resource**.
2. **Resource Type:** `Variable`
3. **API Name:** `activeNavItem`
4. **Data Type:** `Text`
5. **Default Value:** Set this to the unique **Name** of the *first* item you created in Step 1 (e.g., `generalSettings`). This ensures the "General Settings" screen shows first.

<figure><img src="https://docs.avonnicomponents.com/~gitbook/image?url=https%3A%2F%2F27923732-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F1FUd4apB9YHgCEMUFbVb%252Fuploads%252FfY54uDqDDfQbDYVKac02%252F2023-06-04_21-17-34.png%3Falt%3Dmedia%26token%3Dd0974a9b-5f30-4768-a027-814c8bb11bd6&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=e835f63d&#x26;sv=2" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Build the Main "Router"

Now, set up the main “router” logic using a Decision element. This router is responsible for directing users to the correct screen based on which navigation item they’ve selected.

**Why is this important?**\
The router is the heart of your navigation system. Evaluating the \`activeNavItem\` variable ensures that users are directed to the correct screen when they interact with the menu.

1. **Add a Decision Element:** Add a **Decision** element to your canvas after the Apex Action from Step 1.
2. **Create an Outcome for Each Navigation Item:**
   * For your first outcome, set the **Label** to "Go to Welcome".
   * **Condition:** `{!activeNavItem}` **Equals** `generalSettings`.
   * Repeat this for every navigation item you created in Step 1, creating a separate outcome path for each (e.g., "Go to Step 2" where `{!activeNavItem}` equals `step2`).
   * Click **Done**. You should now have your router with a path for each possible screen.

<figure><img src="https://docs.avonnicomponents.com/~gitbook/image?url=https%3A%2F%2F27923732-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F1FUd4apB9YHgCEMUFbVb%252Fuploads%252Fs9725oHvjw0tK483baEj%252F2023-06-04_21-14-29.png%3Falt%3Dmedia%26token%3Dae62223e-3930-4bfa-8597-c48847d9a13d&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=715c66ff&#x26;sv=2" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/EYk7IlL3fhKZeSLaX56r" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Create Your First Screen and Its Assignment

**First Screen Creation**

Next, you’ll build the first full navigation path by creating a screen and connecting it to your router logic. This step is crucial because it activates your navigation structure and ensures that users see the correct content when they select a menu item.

* **Add a Screen Element:** Drag a **Screen** element onto the canvas and connect it to the "General Settings" outcome of your Decision router.
* **Add the Avonni Navigation Component:**
  * Drag the **Avonni Navigation** component onto the screen canvas.
  * **Configure its properties:**
    * **Data Source:** Set this to your `{!navigationItems}` collection variable.
    * **Value:** Set this to your `{!activeNavItem}` variable. This ensures the correct item is highlighted.
* **Add Screen Content:** Drag other components for your "General Settings" view onto the screen.

<figure><img src="/files/ow1qG1kmllQib9bMPrKv" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/TMHnxLXnUz0uDtr5INtw" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/qkW0KBB0zT7FZcDIrgpO" alt=""><figcaption><p>Avonni Navigation Configuration screen</p></figcaption></figure>

**Configure the Navigation Interaction**

This step is essential because it defines what happens when a user clicks on a navigation item. To set it up, open the component builder, go to the Interaction tab, and select the action for the navigation item. Choose the option to move to the next screen in the flow. This ensures that when a user selects a navigation item, the flow automatically takes them to the appropriate screen.

<figure><img src="/files/lyWVLNsa0NZHtY8fdjrd" alt=""><figcaption></figcaption></figure>

**Assignment creation**

Now, add an Assignment element to capture the user’s navigation choice and update the active screen variable. This step is essential because it keeps your navigation state in sync with the user’s actions, ensuring the Flow always displays the correct screen after a menu selection.

* **Add an Assignment Element:** **This is a key step.** Drag an **Assignment** element onto the canvas and connect the "Settings" screen *to this Assignment*.
* **Configure the Assignment:**
  * **Label:** Give it a name like "Set Active Item from Settings Screen".
  * **Set Variable Values:** Configure the assignment to update your state variable.
    * **Variable:** `{!activeNavItem}`
    * **Operator:** `Equals`
    * **Value:** Select the **Avonni Navigation** component from the "Screen Components" section, and then select its **`value`** attribute.
  * Click **Done**.

<figure><img src="/files/1MpChzN48fygn5xFPIJD" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/cbRFgh6x8DgHSHmSwLxo" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Complete the Navigation Loop

This final connection ensures continuous navigation.

1. **Connect Back to the Router:** Drag the connector from the **Assignment** element you just created *back to the Decision element* from Step 3.

**How this logic works:** When the user clicks a new item in the Navigation component, its `value` changes. When the user proceeds from the screen (e.g., clicks the Flow's "Next" button), the **Assignment** element captures that new `value` and updates the `activeNavItem` variable. The loop then sends the Flow back to the **Decision** element, which now reads the *new* value and routes the user to the correct screen.

<figure><img src="/files/cnhY0xEBDZ7eUy3hvecH" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Build and Connect the Remaining Screens

Now that the pattern is established, repeat the process for all other outcome paths from your Decision router:

1. **Add a Screen** element for the next outcome (e.g., "Go to Step 2").
2. Inside the screen, add and configure the **Avonni Navigation** component and your content, just as you did in Step 4.
3. Add an **Assignment** element after the new screen, configuring it to set `{!activeNavItem}` from this new screen's navigation component value.
4. **Connect the Assignment back to the Decision element** to complete the loop for this path.
5. Repeat until all navigation paths are built
   {% endstep %}
   {% endstepper %}

{% hint style="info" %}
**Having trouble with this tutorial**? [Contact Avonni support for help](https://docs.avonnicomponents.com/help/how-do-i-contact-support).
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.avonnicomponents.com/projects/flow-components/get-started/building-left-side-vertical-navigation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
