St.page_link additional attributes

How to align the label parameter of st.page_link to be centered by default and also have a border like st.link_button?

If you want a button to serve as a page link, try using st.button with st.switch_page as a callback:

st.button("Next page", on_click=st.switch_page, args=["pages/your_page.py"])

:slight_smile:

1 Like

Thanks for the tip. When clicked, getting error: Calling st.rerun() within a callback is a no-op.

Ah, sorry about that. Yes, hidden within st.switch_page is indeed an st.rerun. Instead, you can condition it on the button:

if st.button("Next page"):
    st.switch_page("pages/your_page.py")
1 Like

thanks, it works now

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.