New Component: link_button, A simple way to link a button to a URL

Hi,

I just created a custom component to easily link a button to a URL.
Do give it a try :grinning:

pip install link-button
from link_button import link_button

link_button('Click Me!', 'https://docs.streamlit.io/en/stable/')

Open in Streamlit GitHub

10 Likes

Hey this is awesome, no more Markdown links :slight_smile:

are you able to edit the Wiki tracker here : Streamlit Components - Community Tracker with your component? So we can keep track of it!

Have a nice day :balloon:
Fanilo

2 Likes

Love it!

Thanks for sharing @akshanshkmr

1 Like

Thanks @Charly_Wargnier

@andfanilo, I have updated the wiki tracker

Thanks

1 Like

I love it, great work from streamlit

1 Like

Hey @akshanshkmr

I was preparing a little Twittorial with the new components and wanted to test yours, but I’m getting an error from your app

Maybe you could you check what is happening :wink: ?
Have a nice day,
Fanilo

2 Likes

Hi @andfanilo,

The app should work now,
I had deleted it to make room for the newer components i made :sweat_smile:

Thanks for considering my component for the twittorial.

Open in Streamlit

Thanks,
Akshansh

1 Like

@akshanshkmr Is it possible to place it in sidebar? Similar to st.sidebar.* components.

1 Like

Hi @tejasvi88,

Sure you can do that with streamlit sidebar context.

from link_button import link_button

with st.sidebar:
    link_button('test','')

Thanks,
Akshansh

1 Like

@akshanshkmr pls am trying to deploy an app with this library. I keep getting error on streamlit cloud. what do you think is this problem

Hi @kareemrasheed89 ,

My components have been taken down from pypi for some time.

Sorry for the inconvenience

1 Like

@akshanshkmr oooops… what other link button do you think i can use with streamlit, i need to solve a prob for a client

Added to
Streamlit App

2 Likes

Dear Akshanshkmr,

i would like to use your package but pip install link-button doesn’t work.
Do you have an other way to use your function ?

I tried with markdown this in attached file. But it’s not working

Can you help me please

The result

Regards

Hey,

My components are taken down for some time
Sorry for the inconvenience

Thanks,
Akshansh

1 Like

how to change the text color and background color?

1 Like

not available though

1 Like

any way I can access this?

1 Like

Hey, Any follow up on when this would be available ?

Thank you very much

1 Like

St button style markdown button:

def get_st_button_a_tag(url_link, button_name):
    """
    generate html a tag
    :param url_link:
    :param button_name:
    :return:
    """
    return f'''
    <a href={url_link}><button style="
    fontWeight: 400;
    padding: 0.25rem 0.75rem;
    borderRadius: 0.25rem;
    margin: 0px;
    lineHeight: 1.6;
    width: auto;
    userSelect: none;
    backgroundColor: #FFFFFF;
    border: 1px solid rgba(49, 51, 63, 0.2);">{button_name}</button></a>
    '''
st.markdown(get_st_button_a_tag('your link', 'button name'), unsafe_allow_html=True)
1 Like