A Streamlit component for a search bar with autosuggestions
Project description
Streamlit Searchbar Component
A custom Streamlit component that provides a searchbar with autosuggestions functionality.
Installation
You can install the searchbar component using pip:
pip install searchbar_component
Usage
Here's a simple example of how to use the searchbar component in your Streamlit app:
import streamlit as st
from searchbar_component import searchbar
st.title("Searchbar Component Demo")
# Define suggestions and placeholder
suggestions = ["Apple", "Banana", "Cherry", "Date", "Elderberry"]
placeholder = "Type a fruit name"
# Use the searchbar component
result = searchbar(suggestions=suggestions, placeholder=placeholder, key="demo_searchbar")
# Display the search result
st.write("You searched for:", result)
Features
- Autocomplete suggestions as you type
- Customizable styling to match your Streamlit app's theme
- Easy integration with existing Streamlit applications
- Customizable placeholder text
API Reference
searchbar(suggestions=None, placeholder="Type a query", key=None)
Creates a new instance of the searchbar component.
Parameters:
suggestions
(list of str): A list of suggestions to display.placeholder
(str): The placeholder text to display in the search bar.key
(str, optional): An optional key that uniquely identifies this component. If not provided, Streamlit will generate a key.
Returns:
- str: The selected or typed value in the searchbar.
Development
To contribute to this project:
- Clone the repository
- Install development dependencies:
pip install -r requirements-dev.txt
- Make your changes
- Run tests:
pytest
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contact
If you have any questions, feel free to reach out or open an issue on GitHub.
Remember to star this repo if you find it useful! ⭐️
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file searchbar_component-0.1.8.tar.gz
.
File metadata
- Download URL: searchbar_component-0.1.8.tar.gz
- Upload date:
- Size: 445.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4b01a95fed15f2ff68b6afdbed7ca52a9dbf6ada0db10835ffbcbcc6cb46780 |
|
MD5 | 80ec37aa9771002d287adca5b952f2a4 |
|
BLAKE2b-256 | 6385b5b03bb158ee4895ac91b21589edd8c1cdd25ba3a6d6e4972569c16b9f3b |
File details
Details for the file searchbar_component-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: searchbar_component-0.1.8-py3-none-any.whl
- Upload date:
- Size: 448.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d35d61a8f259229426226b2fb9ccab561688a1d8276a68185fa9dba310ff6e4a |
|
MD5 | b3181caf8e089e5087844df6b1a51cf9 |
|
BLAKE2b-256 | 37aa03373e596ecf183cf330225a242b4d3c4ba2e19eba67f08b8f2a423e4889 |