I wanted to ask if there is a functionality that lets you block some tabs till a condition happens.
Imagine my Streamlit App works as a âflow appâ, that needs the code in the first tab already ran to make the second tab code work, so it doesnât give errors.
I wanted to know if there is any way to âblockâ some tabs till a condition happens in the previous tab (like clicking a button, for example), so my app doesnât break.
I would need this so the user of the app (not me, I already know that I shouldnât click next tab if the current tab code is not done running) cannot break it while clicking other tabs.
You can have a session variables (either a common list for all the steps /tabs you have OR individual variables for each step /tab), each equating to True / False, to indicate that a step is complete or not. That way the user will need to complete the previous step before going on to the next step.
Thank you @Shawn_Pereira !
I assume that executing your response would make the second tab not work after clicking it, but I would like to find a way to âbanâ the user of clicking this second tab, in order to not change tabs till this session state variable == True.
Is it possible to achieve this?
Hi @Monica_de_Santos_Rod, with the StepperBar component, you will be able to force the user to choose the 2nd option only after the 1st option is completed⌠You will need to pip install this component first (from the location mentioned above).
If you still want to use st.tabs, you canât prevent / ban a user from clicking on a tab, but you can prevent showing or show details in the 2nd tab, based on if a result is achieved in the 1st tab.
Thank you @arnaud and @Shawn_Pereira for your answers and the demo!
I wanted to ask also for the same thing but for multipage apps, so instead of tabs if would be the different pages. Is this possible?
Thank you ! @Shawn_Pereira
Iâm already using Streamlit Multipage-app.
Could you tell me the exact name of the functionality to block the pages with Hydralit or the Option-Menu Component? (Iâve been looking at the documentation but couldnât find it)