Lots of tab components out there and we now have the streamlit official tabs component. Great! If however you are like me and in need of a dynamic tabs component, one that you can create and close like you would browser tabs, then here you go.
Repository is located here
You can create a function that saves the tab titles and data users attach to them in some database and load them up when they visit the page:
Also, mobile support which has a more compact feel and a bouncy add tab button
- Can add saved tab titles to be loaded up for users to view their previously saved tabs
- Change the add button via material icons (google)
- Can limit the number of tabs a user can create
- Can change the design of the tabs
- When there is only one tab, the close button does not appear. This is because upon creating a new tab, the tab is active but value is not passed onto streamlit. So create some code to direct users to click on the tab to view content. Wanted to limited the use of Streamlit’s api to send values to the python as it creates buggy behaviour in the component.
Woot woot need to try this!
Feel free to add it in the Streamlit Components - Community Tracker so we don’t lose track of it
Have a nice day!
Great component @Rushmore! Thanks for sharing it here!
Out of interest, is there a demo deployed anywhere?
@andfanilo Glad you like it and its been put up.
@Charly_Wargnier Glad you like it. I have just deployed it (demo-app)
Very nice! Thanks for sharing!
That’s another great component from @Rushmore.
I have a rookie question: If the end-user can create tabs at runtime, how can the application post matter/ data / some text within these on-the-fly created tab containers?
Hello again ahaha thanks.
I will cook something up and post it later in the day.
I have updated the package to be able to do this. Ver 0.0.3 also sends the deletedtab object so that you can remove it from your database. View the demo which has been updated.
Note that github is not updating the data.json file but in an environment where this is capable, like in your local environment, it should work properly.
Thanks @Rushmore, will check this out and give you a feedback as soon as I can.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.