π«΅Β Β Mentions
Submitted by Arnaud Miribel
Summary
Create nice links with icons, like Notion mentions!
Functions
mention
Mention a link with a label and icon.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
label |
str
|
Label to use in the mention |
required |
icon |
str
|
Icon to use. Can be an emoji or a URL. Default 'π' |
'π'
|
url |
str
|
Target URL of the mention |
required |
write |
bool
|
Writes the mention directly. If False, returns the raw HTML. Useful if mention is used inline. |
True
|
Source code in src/streamlit_extras/mention/__init__.py
Import:
- You should add this to the top of your .py file
Examples
example_1
def example_1():
mention(
label="An awesome Streamlit App",
icon="streamlit", # Some icons are available... like Streamlit!
url="https://extras.streamlitapp.com",
)
Output (beta)
example_2
def example_2():
mention(
label="streamlit-extras",
icon="πͺ’", # You can also just use an emoji
url="https://github.com/arnaudmiribel/streamlit-extras",
)
Output (beta)
example_3
def example_3():
mention(
label="example-app-cv-model",
icon="github", # GitHub is also featured!
url="https://github.com/streamlit/example-app-cv-model",
)
Output (beta)
example_4
def example_4():
mention(
label="That page somewhere in Notion",
icon="notion", # Notion is also featured!
url="https://notion.so",
)
Output (beta)
example_5
def example_5():
inline_mention = mention(
label="streamlit",
icon="twitter", # Twitter is also featured!
url="https://www.twitter.com/streamlit",
write=False,
)
st.write(
f"Here's how to use the mention inline: {inline_mention}. Cool" " right?",
unsafe_allow_html=True,
)