Skip to main content

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:

  1. Clone the repository
  2. Install development dependencies: pip install -r requirements-dev.txt
  3. Make your changes
  4. Run tests: pytest
  5. 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


Download files

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

Source Distribution

searchbar_component-0.1.8.tar.gz (445.6 kB view details)

Uploaded Source

Built Distribution

searchbar_component-0.1.8-py3-none-any.whl (448.8 kB view details)

Uploaded Python 3

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

Hashes for searchbar_component-0.1.8.tar.gz
Algorithm Hash digest
SHA256 d4b01a95fed15f2ff68b6afdbed7ca52a9dbf6ada0db10835ffbcbcc6cb46780
MD5 80ec37aa9771002d287adca5b952f2a4
BLAKE2b-256 6385b5b03bb158ee4895ac91b21589edd8c1cdd25ba3a6d6e4972569c16b9f3b

See more details on using hashes here.

File details

Details for the file searchbar_component-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for searchbar_component-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 d35d61a8f259229426226b2fb9ccab561688a1d8276a68185fa9dba310ff6e4a
MD5 b3181caf8e089e5087844df6b1a51cf9
BLAKE2b-256 37aa03373e596ecf183cf330225a242b4d3c4ba2e19eba67f08b8f2a423e4889

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