Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#2292 allow menu to be expanded by default #2508

Conversation

MiguelLehmann
Copy link
Contributor

@MiguelLehmann MiguelLehmann commented Mar 21, 2025

What type of PR is this?

  • Feature

Description

I added the "expanded" parameter to the Menu component. It is a boolean that, when set to true, causes the menu to start off expanded.

Screenshot 2025-03-21 160053

Default value is false, which starts the menu folded.

Screenshot 2025-03-21 160025

Related Tickets & Documents

Feature description

Running this code will generate a folded menu:

from taipy.gui import Gui
import taipy.gui.builder as tgb

options = [("a", "Option A"), ("b", "Option B"), ("c", "Option C"), ("d", "Option D")]

with tgb.Page() as page:
tgb.menu(label = "options",
lov = options,
)

if name == "main":
Gui(page).run(title="Menu - Selected")

By setting the "extended" property to "True", the menu will start expanded:

[...]

with tgb.Page() as page:
tgb.menu(label = "options",
lov = options,
expanded = True,
)

[...]

Checklist

  • This solution meets the acceptance criteria of the related issue.
  • This PR adds unit tests for the developed code.

Copy link
Member

@FredLL-Avaiga FredLL-Avaiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to add the property to viselements.json.
And tests are never too much :-)

@MiguelLehmann
Copy link
Contributor Author

MiguelLehmann commented Mar 21, 2025

Thank you for your feedback, I will make sure to adjust my contribution accordingly.

@FredLL-Avaiga FredLL-Avaiga added 🖰 GUI Related to GUI 🟧 Priority: High Must be addressed as soon ✨New feature 📝Release Notes Impacts the Release Notes or the Documentation in general labels Mar 21, 2025
@MiguelLehmann
Copy link
Contributor Author

MiguelLehmann commented Mar 24, 2025

I adjusted my contribution according to your feedbback, also ading the unit test "starts folded unless 'expanded' is true" to Menu.spec.tsx, which covers the added feature.

Copy link
Member

@FredLL-Avaiga FredLL-Avaiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work
we need to find a way to not have the package-lock.json files in the PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you find a way to remove the package-lock.json files from the PR ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only way I found was to redo the changes in a different branch, this time not pushing these unnecessary files. Now, I could either replace the contents of this fork with those of the new branch (as far as I can tell this would be a permanent override) or open a new PR based on the new branch. Which one would you prefer?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new PR is fine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new PR is called "Feature/#2292 allow menu to be expanded by default (Redo)"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file shouldn't exist

@MiguelLehmann
Copy link
Contributor Author

Will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖰 GUI Related to GUI ✨New feature 🟧 Priority: High Must be addressed as soon 📝Release Notes Impacts the Release Notes or the Documentation in general
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Have Menu expanded by default or not
2 participants