Skip to content

Commit 5a2feba

Browse files
committed
Shorten examples in README
1 parent 1cb01cc commit 5a2feba

File tree

1 file changed

+3
-53
lines changed

1 file changed

+3
-53
lines changed

README.md

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pip install streamlit-scroll-navigation
6161
import streamlit as st
6262
from streamlit_scroll_navigation import scroll_navbar
6363

64-
# Specify anchor IDs and icons
64+
# Anchor IDs and icons
6565
anchor_ids = ["About", "Features", "Settings", "Pricing", "Contact"]
6666
anchor_icons = ["info-circle", "lightbulb", "gear", "tag", "envelope"]
6767

@@ -70,8 +70,7 @@ with st.sidebar:
7070
st.subheader("Example 1")
7171
scroll_navbar(
7272
anchor_ids,
73-
#key="navbar1", #use for first navbar
74-
73+
anchor_labels=None, # Use anchor_ids as labels
7574
anchor_icons=anchor_icons)
7675

7776
# 2. horizontal menu
@@ -82,56 +81,7 @@ scroll_navbar(
8281
anchor_icons=anchor_icons,
8382
orientation="horizontal")
8483

85-
# 3. Custom anchor labels with no icons
86-
st.subheader("Example 3")
87-
scroll_navbar(
88-
anchor_ids,
89-
key="navbar3",
90-
anchor_labels=["About Us", "The Features", "The Settings", "The Pricing", "Contact Us"],
91-
orientation="horizontal")
92-
93-
# 4. Style overrides
94-
st.subheader("Example 4")
95-
scroll_navbar(
96-
anchor_ids=anchor_ids,
97-
key="navbar4",
98-
orientation="horizontal",
99-
override_styles={
100-
"navbarButtonBase": {
101-
"backgroundColor": "#007bff", # Set a custom button background color
102-
"color": "#ffffff", # Set custom text color
103-
},
104-
"navbarButtonHover": {
105-
"backgroundColor": "#0056b3", # Set a custom hover color for the buttons
106-
},
107-
"navigationBarBase": {
108-
"backgroundColor": "#f8f9fa", # Change the navigation bar background color
109-
}
110-
}
111-
)
112-
113-
# 5. Force anchor
114-
st.subheader("Example 5")
115-
force_body = None
116-
if st.button("Go to Body"):
117-
force_body = "Body"
118-
scroll_navbar(
119-
anchor_ids,
120-
key="5",
121-
anchor_icons=anchor_icons,
122-
orientation="horizontal",
123-
force_anchor=force_body)
124-
125-
# 6. Retrieve active anchor
126-
with st.sidebar:
127-
st.subheader("Example 6")
128-
active_anchor = scroll_navbar(
129-
anchor_ids,
130-
key="navbar6",
131-
orientation="vertical")
132-
st.write(f"{active_anchor} is active")
133-
134-
# Setup dummy page
84+
# Dummy page setup
13585
for anchor_id in anchor_ids:
13686
st.subheader(anchor_id,anchor=anchor_id)
13787
st.write("content " * 100)

0 commit comments

Comments
 (0)