New Component: streamlit-redirect - Move to other pages directly from code

Hi everyone,

The streamlit-redirect component helps you to streamlit your app navigation and trigger redirect events.

I have been trying to perform conditional moves from one page to another. For instance in response to a button click.
However there has not really been a stand-alone solution.

So I created a little streamlit-redirect component

Here’s the Github Link: GitHub EVOBYTE streamlit-redirect

As always you can simply install it from PyPI

pip install streamlit-redirect

And here’s a short example how to redirect in response to a button

import streamlit as st
from streamlit_redirect import redirect

# Redirect after button click
if st.button("Go to Streamlit"):
    redirect("https://www.streamlit.io")

# Redirect based on user input
url = st.text_input("Enter a URL:")
if url:
    redirect(url)

Checkout the official repo to learn more.

I happy for questions or comments

Best,

Jonathan

3 Likes