4D Blog

Home Tips Designing an Interactive and Dynamic Menu Bar in Qodly application

Designing an Interactive and Dynamic Menu Bar in Qodly application

April 7, 2025

Tips

In this week’s blog, we take a look at navigation. Navigation is a key element of any web application. A well-structured navigation system enables users to quickly find what they need and enhances their overall experience.

With 4D Qodly Pro, managing navigation is both simple and flexible. Using the Page Loader component, you can dynamically load pages based on user actions.

In this article, we will explore how to set up an efficient navigation bar using 4D Qodly Pro. We will use our Performance Review application as an example, which you can download from GitHub (link to be added). We will cover its design, interactions, and permission management to create a seamless experience tailored to each user role.

Performance Review Application

Loading Pages with the Page Loader

Loading a page with 4D Qodly Pro is intuitive. Simply drag and drop the Page Loader component onto your interface and associate it with a text-based datasource.

blank

The Page Loader automatically loads the page corresponding to the value stored in the datasource. By updating this value, users can navigate seamlessly between different pages in the application.

Choosing the Right Navigation Type

Now that we understand how to load pages using the Page Loader, we need to determine how to dynamically modify this datasource to facilitate smooth and intuitive navigation.

There are three primary types of navigation:

  • Menu bar: A traditional, always-visible navigation bar ideal for quick access.
  • Hamburger menu: A collapsible menu accessed via an icon, perfect for mobile applications.
  • Sidebar menu: Positioned on the side, suitable for complex applications with multiple sections.

 

The navigation type should be chosen based on the specific needs of your application and target users. A well-designed navigation system improves user experience and ensures easy access to key functionalities.

For the Performance Review application, we opted for a classic menu bar. This approach allows quick access to different sections while ensuring a smooth experience on both desktop and tablet devices.

Creating a Navigation Bar

Our navigation bar is designed to be simple, efficient, and user-friendly. Here are its main features:

  • A fixed-height navigation bar with a sticky option to remain visible at the top.
  • The application’s icon and name.
  • A Human Resources dropdown menu containing:
    • Collaborator
    • Review
    • Training
  • A Manager button.
  • A Collaborator button.
  • The name of the logged-in user.
  • A Logout button.

 

blank

 

Creating the top Bar

The navigation bar is displayed at the top of the screen at all times. To achieve this, we create a style box with a sticky property:

  • position: sticky ensures the bar remains visible during scrolling.
  • top: 0 and left: 0 position the bar at the top-left of the page.

 

blank

 

Adding the Application Icon and Title

We use a style box with Flexbox to align elements and maintain responsiveness across various screen sizes.

blank

Inside this box:

  • An Image component for the icon.
  • A Text component to display the application name.

Creating the menus

A second style box (using Flexbox) is added to contain both the dropdown menu and the two navigation buttons.

Creating the “Human Resources” Dropdown Menu

To create the dropdown menu, we use a custom component called Popover. You can download this component from GitHub.

  • Drag and drop the Popover component onto your page.
  • In the menu section, add a static text titled Human Resources.
  • In the overlay section, insert three buttons labeled Collaborator, Reviews, and Trainings.

blank

For more details on custom components, refer to our previous blog post: “Extend our Qodly application with custom components”

Adding the Manager and Collaborator button

Simply add two separate buttons labeled “Manager” and “Collaborator.”

Creating the logged info area

A third style box (using Flexbox) is used to display the logged-in user’s name and provide a logout action.

  • A Text component, bound to the username datasource, displays the logged-in user’s name on the right side of the navigation bar.

blank

  • The Logout button allows users to quickly sign out. On the button’s onClick event, assign the standard authentication logout action.

blank

For more details on authentification, check out this previous blog post: Integrating user authentication in your Qodly applications.

Implementing Navigation Interactions

Navigation is managed through a variable called pageName, which acts as the datasource for the Page Loader.

  • Each menu element is associated with an action that updates the pageName value.
  • When the user clicks a button, the corresponding page is dynamically loaded.
  • For each button, we apply the Set Datasource action on the onClick event:
    • pageName = “CollaboratorPage” to display the Collaborator page.
    • pageName = “ManagerPage” to display the Manager page.
    • And so on…

blank

This approach ensures a smooth and fast navigation experience without reloading the application.

Managing Permissions

Not all menu buttons are visible to every user. Their visibility depends on user roles:

  • Collaborator: Access only to the Collaborator page.
  • Manager: Access to Manager and Collaborator pages.
  • HR: Access to all pages.

We use state management to dynamically control which options are visible based on the logged-in user’s role.

Handling Multiple Roles

A Manager has a dual role:

  • As a Collaborator, they complete their own performance review.
  • As a Manager, they review and validate the performance reviews of their team members.

To handle this, we define two datasources:

  • userInfo.maxRole: Represents the highest role assigned to the user.
  • userInfo.role: Represents the currently active role the user is using.

 

Populating the Datasources:

During authentication, using the ds.authentify() function, user information is stored in session storage:

var $obj : Object
$obj:=Session.storage

If ($obj.Employee=Null)
  Use ($obj)
   $obj.Employee:=New shared object
  End use
End if

Use ($obj.Employee)
  $obj.Employee.ID:=$employee.ID
  $obj.Employee.name:=$employee.Firstname+" "+$employee.Lastname
  $obj.Employee.role:="Collaborator"
  $obj.Employee.maxRole:="Collaborator"
End Use

A helper function getUserInfo() is provided to retrieve user details within Web page:

exposed Function getUserInfo : Object
  If (Session=Null)
   return Storage.Employee
  Else
   return Session.storage.Employee
  End if

On the login button’s onClick event, both functions are called:

  • ds.authentify()
  • ds.getUserInfo()

 

blank

Creating and Configuring States:

  • Click on the “+” button, to add states.

 

blank

 

  • Create a maxManager state, where the Human Resources menu is hidden (display: none).

 

blank

 

  • Create a maxCollaborator state, where Human Resources, Manager, and Collaborator options are hidden. Since a Collaborator only has access to one page, the navigation menu becomes unnecessary.

 

blank

 

Define conditional display rules:

We want:

  • If userInfo.maxRole = “hr”, display the default state.
  • If userInfo.maxRole = “manager”, display the Manager state.
  • If userInfo.maxRole = “collaborator”, display the Collaborator state.

These rules are easily implemented using Qodly Studio’s conditional state configuration editor. 

maxCollaborator

blank

maxManager

blank

For more details on state management, check out our previous blog post: Make your Qodly applications dynamic and interactive with states.

Other states exist to manage the menu, the login window, or the selected menu item. It’s up to you to explore how it is configured, and feel free to join us on the forum if you have any questions.

Optimizing for Different Screen Sizes

Our application is designed for both desktop and tablet usage. To ensure an optimal user experience, the navigation bar is fully responsive.

  • Hiding certain elements when the screen is too small (e.g., application name and logged-in user’s name).
  • Rearranging the menu into a column layout on smaller screens to maximize space.

 

Dynamic hiding of elements is managed via CSS media queries (e.g., using max-width), while Flexbox with the Wrap option ensures the menu automatically adjusts based on available space.

  • Large screen

blank

  • Medium screen

blank

  • Small screen

blank

For further insights into CSS customization in Qodly Studio, refer to our previous post: Customize your Qodly interfaces with CSS.

Next Steps

You now have the essential elements to create an interactive and dynamic navigation bar with 4D Qodly Pro.

We encourage you to share your implementations and ask questions on the 4D Forum to continue engaging with the community.

Discuss

Tags 20 R8, 21, 4D Qodly Pro, Navigation, Performance Review Application, Qodly Studio, Tutorial

Latest related posts

  • September 15, 2025

    Find the right spot in your 4D Write Pro document with AI

  • September 2, 2025

    Intelligent 4D Write Pro document analysis with AI

  • August 25, 2025

    ORDA – Constructor and touched event – Detailed behaviour through a network

Vanessa Talbot
Vanessa Talbot
• Product Owner •Vanessa Talbot joined 4D Program team in June, 2014. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • AI
  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy