Skip to main content
Question

Need Help: Side Nav Component Variants Not Updating Based on Variable in Design System

  • June 2, 2025
  • 1 reply
  • 68 views

Jpchanna

Hi all,
Iโ€™m working on a design system and trying to create an interactive side navigation menu using component variants + a shared variable (selectedItem). Each nav item has two variants: default and selected.

Hereโ€™s what Iโ€™ve set up:

  1. Each menu item has a label property (e.g., "Dashboard", "Settings", etc.)

  2. On click, the interaction sets the variable: selectedItem = "Settings"

  3. Then I added conditional logic:
    โ€ƒโ€ข If selectedItem == "Settings" โ†’ switch to selected
    โ€ƒโ€ข Else โ†’ switch to default

๐ŸŽฏ Goal: When one nav item is selected, all other items should revert to default โ€“ only one selected item at a time.

โŒ Issue: Only the clicked item changes. The rest donโ€™t respond to the variable update.
โœ… I even tried using While value of variable changes or placing the logic in each itemโ€™s On Click โ€“ still not getting the expected behavior.

๐Ÿ‘‰ What am I missing? How can I ensure all nav items reactively update based on the selectedItem variable?

This is for a reusable side nav component in my design system, so it needs to be scalable.
Any guidance, working examples, or best practices would be super helpful. ๐Ÿ™

This topic has been closed for replies.

1 reply

Jpchanna
  • Author
  • New Member
  • June 2, 2025

Or what is the best solution to handle this?

ย