๐ฏย ย Radial Menu
Submitted by Debbie Matthews
Summary
A circular menu component that displays options in a ring around a central button.
Functions
radial_menu
Display a radial menu with the given options.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
options
|
dict[str, str]
|
A dictionary mapping option values to their display icons/emojis. Example: {"home": "๐ ", "search": "๐", "settings": "โ๏ธ"} |
required |
default
|
str | None
|
The default selected option. If None, uses the first option. |
None
|
key
|
str
|
A unique key for this component instance. |
'radial_menu'
|
Returns:
| Type | Description |
|---|---|
RadialMenuState
|
A TypedDict with a "selection" key containing the currently selected option value. |
Example:
```python
result = radial_menu({"home": "๐ ", "search": "๐", "settings": "โ๏ธ"})
st.write(f"Selected: {result['selection']}")
```
Source code in src/streamlit_extras/radial_menu/__init__.py
Import:
- You should add this to the top of your .py file
Examples
example
def example() -> None:
"""Example usage of the radial menu component."""
import streamlit as st
st.write("Click the button below to open the radial menu:")
result = radial_menu(
options={
"home": "๐ ",
"search": "๐",
"settings": "โ๏ธ",
"profile": "๐ค",
"help": "โ",
},
key="demo_menu",
)
st.write(f"**Selected:** `{result['selection']}`")