Skip to main content

Streamlit Button Selection Component

Project description

Logo

Version License Ko-Fi

Streamlit Button Select Component


Sometimes you want a user to make a selection, but you only have a few options.
Using an st.selectbox component works, but wouldn't it be easier to simply have a few buttons in a row ?
Well, this custom component allows just that !

Installation

pip install st_row_buttons

Getting Started

Creating a Button Selection is really easy.

from st_row_buttons import st_row_buttons

selection = st_row_buttons(('option 1', 'option 2', 'option 3'))

You can also use this component as a small top navigation bar.

from st_row_buttons import st_row_buttons

page = st_row_buttons(
  # The different pages
  ('home', 'about', 'docs', 'playground'),
  # Enable navbar
  nav=True,
  # You can pass a formatting function. Here we capitalize the options
  format_func=lambda name: name.capitalize(),
)

# Display the right things according to the page
if page == 'home':
  st.write('HOMEPAGE')

NOTE
There can only be one navbar per page, as they will be displayed on top of each other.

The navbar buttons do not set any URL hashes, and thus the different pages are not bookmarkable, nor can you use the browser history.

Documentation

Check out this streamlit app for the documentation, as well as a demo.
Open in Streamlit

pypi-AgEIcHlwaS5vcmcCJGE1ZDc3MWY2LWZiZjMtNDM1Yy04YzMxLTAwZjQwNThlNjIwZgACJXsicGVybWlzc2lvbnMiOiAidXNlciIsICJ2ZXJzaW9uIjogMX0AAAYgr88ILL5mY-1H0rgPN5UjLUTt8ggY2ODParisMq71Bnc

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

st_row_buttons-0.0.3.tar.gz (502.3 kB view details)

Uploaded Source

Built Distribution

st_row_buttons-0.0.3-py3-none-any.whl (508.8 kB view details)

Uploaded Python 3

File details

Details for the file st_row_buttons-0.0.3.tar.gz.

File metadata

  • Download URL: st_row_buttons-0.0.3.tar.gz
  • Upload date:
  • Size: 502.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.1

File hashes

Hashes for st_row_buttons-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e9d942321553798c3a3c98a618e1822396a9e747889ca4d14f84bd4d269fc081
MD5 1c24e0b0ba87063a10845b6d36e9e0af
BLAKE2b-256 4abf846c8d12ba3135e03879c2043e1e536a2ed5c4be1e405c639f46f2e0d574

See more details on using hashes here.

File details

Details for the file st_row_buttons-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for st_row_buttons-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 14174c13b1de4d63073c15d4a51d57f25f5423873c9d57e9fe5b616a91d0da30
MD5 818d6f71b15482e4677d9e060639eedf
BLAKE2b-256 90d4ebcd6c2940b184389148f8b92025c7f71a2bb4bb5b3ca50656a6b752765f

See more details on using hashes here.

Supported by

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