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

Ability to add custom items to hamburger menu #396

Closed
tvst opened this issue Oct 14, 2019 · 9 comments
Closed

Ability to add custom items to hamburger menu #396

tvst opened this issue Oct 14, 2019 · 9 comments
Labels
feature:hamburger-menu status:unlikely Will probably not implement but looking for further feedback type:enhancement Requests for feature enhancements or new features

Comments

@tvst
Copy link
Contributor

tvst commented Oct 14, 2019

Related issue: #395

Some users would like to add items to the hamburger menu. To support this we'd have to think more deeply about the API for that. For example, would something like this be good enough for real-world use:

clicked_menu_item = st.menu_items(['Item 1', 'Item 2', 'Item 3'])

if clicked_menu_item == 'Item 1':
  do_stuff()
elif clicked_menu_item == 'Item 1':
  etc etc

What this would do: it would add "Item 1", "Item 2", and "Item 3" at the top of the hamburger menu, followed by a separator. All items that Streamlit puts in there would go below the separator.

(And if we implement the ability to [hide the menu](Related thread: https://discuss.streamlit.io/t/how-do-i-hide-remove-the-menu-in-production/362/3), when hidden only the Streamlit items would disappear.)


Community voting on feature requests enables the Streamlit team to understand which features are most important to our users.

If you'd like the Streamlit team to prioritize this feature request, please use the 👍 (thumbs up emoji) reaction in response to the initial post.

@tvst tvst added type:enhancement Requests for feature enhancements or new features spec needed labels Oct 14, 2019
@MarcSkovMadsen
Copy link

MarcSkovMadsen commented Oct 14, 2019

When you develop the api, layout and formatting of this please consider if the hamburger menu is enough. I would like to be able to make a menu at the top and fixed as well.

Just like these guys :-)

image

So maybe some options like

clicked_menu_item = st.menu_items(['Item 1', 'Item 2', 'Item 3'], expanded=True, floating=True, emphasized_items=[0])

would be cool. And if the there is not enough space on the screen to expand then it should not expand.

@MarcSkovMadsen
Copy link

MarcSkovMadsen commented Oct 14, 2019

And in the end I would really like a tree menu. Because I believe I would have a lot of pages in the applications I develop. And I would need to structure them in a tree structure.

@MarcSkovMadsen
Copy link

MarcSkovMadsen commented Oct 14, 2019

But @tvst. Your requirements are the must have requriements and would keep things simple though.

@karriebear
Copy link
Contributor

@arraydude does what you're doing with the menu get us here or at least most of the way? Beyond getting notified that the menu needs to be changed, I'm not sure what's going on with the actual processing of the message.

@aaossa
Copy link

aaossa commented Apr 4, 2022

Hi, any news on this? In particular, I'm interested in just hiding the menu. Maybe I could explore the code a bit to provide a PR, but I'm not sure about how do you guys would prefer to implement this

@jrieke
Copy link
Collaborator

jrieke commented Feb 10, 2023

Hey all! Would love to hear some concrete use cases of what you'd want to do with custom menu options. The only things I see mentioned above are:

  1. App navigation, which is covered by multipage apps now.
  2. Hiding the hamburger, which is tracked in Ability to hide the hamburger menu #395 (will write some updates there soon).

If we see some good use cases, we might consider this. But at the moment, it's pretty unlikely we will implement this since I can't see many reasons why people would want this.

@vhoulbreque
Copy link

@jrieke In my case, I have more than 20 (and growing) different Streamlit apps running, each from a different GitLab repo.

I would like to put a link in the Hamburger Menu to "open an Issue / report a bug" to the GitLab repo of the app. The link would, just like the current "Report a bug" option, open a link to create an issue (on the repo of the streamlit app, not the Streamlit GitHub repo).

I find it would be far cleaner to put that link inside the Hamburger menu instead of the sidebar, a footer or anywhere else.

@jrieke
Copy link
Collaborator

jrieke commented Feb 10, 2023

@vinzeebreak This is possible today by:

st.set_page_config(menu_items={"Report a Bug": "<your URL>"})

See the docs for st.set_page_config.

@jrieke jrieke added the status:unlikely Will probably not implement but looking for further feedback label Feb 10, 2023
@jrieke
Copy link
Collaborator

jrieke commented Sep 7, 2023

Closing since 1) this issue is very old, 2) most of the requests in the comments above should be solved by recent features (menu_items parameter in st.set_page_config, multipage apps, client.toolbarMode config option to hide the menu), and 3) we are not planning to allow any more customization of the app menu beyond what's possible today. The app menu should be a very compact set of options to control the app in its current context (e.g. locally, deployed, etc).

If you still want this, please open a new issue and describe your exact use case.

@jrieke jrieke closed this as completed Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:hamburger-menu status:unlikely Will probably not implement but looking for further feedback type:enhancement Requests for feature enhancements or new features
Projects
None yet
Development

No branches or pull requests

8 participants