Basic question that I can’t seem to find an answer for; might be too obvious lol
Suppose I want to hyperlink from my app to another component/element/section/etc. in my same app.
E.g., something like this:
with st.container():
st.write(" ⚠️ Some important information")
… later on, elsewhere in the app …
st.markdown("See [above](link to ⚠️ section) for more information")
Further it would be interesting/cool if you could link to containers/elements directly, like if you had some flavor of reference to say a st.line_chart in your app source code, then you could link to that to navigate the user to that component directly.
The simplest solution is to use header elements and link to them. You can always introduce custom scripting to jump to arbitrary elements, but you get header links for free.
For example, you can jump to a header element using a markdown link:
import streamlit as st
st.header("Some header")
st.markdown("Lorem ipsum "*1000)
st.markdown("Go to [header](#some-header)")
This also applies to headers written in markdown:
import streamlit as st
st.markdown("#### Jump to me")
st.markdown("Lorem ipsum "*1000)
st.markdown("Go to [jump](#jump-to-me)")
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.