Skip to main content

Streamlit component for single page navigation scrolling.

Project description

streamlit-scroll-navigation

scroll_navbar is a Streamlit component that enables scroll-based navigation for seamless single-page applications. It features:

  • Silky smooth scroll and anchor animations
  • Configurable navbar icons
  • Highly configurable CSS

Installation

pip install streamlit-scroll-navigation

Usage

Examples

# Create a dummy streamlit page 
import streamlit as st
from streamlit_scroll_navigation import scroll_navbar

# Dummy page setup
anchor_ids = ["About", "Features", "Settings", "Pricing", "Contact"]
anchor_icons = ["info-circle", "lightbulb", "gear", "tag", "envelope"]
for anchor_id in anchor_ids:
    st.subheader(anchor_id)
    st.write(["content "] * 100)

# 1. as sidebar menu
with st.sidebar:
    scroll_navbar(
        anchor_ids,
        anchor_icons=anchor_icons)

# 2. horizontal menu
scroll_navbar(
        anchor_ids,
        anchor_icons=anchor_icons,
        orientation="horizontal")

# 3. CSS style definitions

# 4. Force anchor
force_body = None
if st.button("Go to Body"):
    force_body = "Body"
scroll_navbar(
        anchor_ids,
        anchor_icons=anchor_icons,
        orientation="horizontal",
        force_anchor=force_body)

# Retrieving active anchor
active_anchor = scroll_navbar(
    anchor_ids,
    orientation="horizontal")
st.write(f"{active_anchor} is active")

Details

This component is built on React. It uses parent DOM injection to enable cross-origin interactions. The API and default aesthetic are inspired by victoryhb's streamlit-option-menu.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit_scroll_navigation-0.1.0.tar.gz (751.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_scroll_navigation-0.1.0-py3-none-any.whl (754.9 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_scroll_navigation-0.1.0.tar.gz.

File metadata

File hashes

Hashes for streamlit_scroll_navigation-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fd9e802b6d9ac6de35c34466de3a14a645db56e65b16b247a50ed78d3a5e2cb4
MD5 425f196d483ec00c6ec873bdc66827d6
BLAKE2b-256 26079645753510d45dd18f95b047e39ff186a5b414c5c4e54575b454563a1f69

See more details on using hashes here.

File details

Details for the file streamlit_scroll_navigation-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_scroll_navigation-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 caf6d5787f16aef8f05459f8c8c2472e10e1422ca0298a9bade971d2e67af257
MD5 a7f94ceb7380ea7dc82d3ab26bb81368
BLAKE2b-256 f4bf711d01c9629d90728bb4ef44735f378847eddaaf1c4fc7088739bcbbce64

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page