Feature request: Tabs
See original GitHub issueProblem
Sorry if this has been discussed before (couldn’t find anything here on on the forum). While building my app, I thought it could be nice to have a tabbed UI component, e.g. to show different “views” of the data (visualisation, table view, JSON, more detailed docs etc.) If the user clicks a tab, that content is generated – otherwise it’s not.
Solution
API could maybe look something like this? Specifying the group name could be optional (default is the same group).
with streamlit.tab("Tab one", "tabgroup1"):
st.write("This is tab content and only run if user selects the tab")
with streamlit.tab("Tab two", "tabgroup1"):
st.write("This is tab content and only run if user selects the tab")
Additional context
Probably clear, but better to be explicit. By “tabs”, I mean something like this:
Issue Analytics
- State:
- Created 4 years ago
- Reactions:150
- Comments:16
Top Results From Across the Web
Feature request: Tabs · Discussion #5109 · supabase ... - GitHub
Currently if I write a query on the SQL Editor and wanna see it directly in the table I can either navigate to...
Read more >Feature requests??? - Ultimate Guitar
Is there a forum or other place to request new features for the app? I like to add notes to myself in the...
Read more >[Feature Request] Split screen for Tabs
Hi! I would like to see the split screen function for tabs to be implemented in Edge, where you can view two tabs...
Read more >Working with Tabs feature request - Soft8Soft
Tabs help organize things, but I'd like a few additions to the UI: 1 - Renaming Tabs 2 - Reordering Tabs 3 -...
Read more >[Feature Request] More Flexible Slider & Tabs
[Feature Request] More Flexible Slider & Tabs ... so like Posts element is super flexible - ideally Sliders and Tabs could be the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So I finally got around to trying the markdown + bootstrap + query parameters hack that was in my head and it sorta works. You’ll lose all widget values because each tab link would refresh the whole page I think, so if you want to preserve variables you’d probably have to have all of them stored as a query parameter instead of just the tab values. Here’s code that works for me on streamlit==0.80.0 and a little demo on my old, slow, computer:
A more streamlit-native approach to tabs that treats tab selection as just another widget value to remember would be much more ideal, but this is a potential interim solution, especially if you don’t need to preserve widget values between tabs.
And @ines
I really like the api you are proposing. I have requested something similar for the app and grid layout here.
https://github.com/streamlit/streamlit/issues/486#issuecomment-548666166