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.7.tar.gz (445.6 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file searchbar_component-0.1.7.tar.gz.

File metadata

  • Download URL: searchbar_component-0.1.7.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.7.tar.gz
Algorithm Hash digest
SHA256 7f8d7ed6525cd001e2a4eedb64c6fbe0c26fb9f55b643f224a3fe19cb942d42c
MD5 8b7df57632b02853144d8809b1ac8145
BLAKE2b-256 665fe7dabf14d7f3a9783b47afe1d68a2e4bd8bdfcf261780e3e10b5c43461fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for searchbar_component-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ca779c958fcb9f3f072a22a43f2eeffd88194cafb9792a4fa3f592a9e370b40f
MD5 ec7e8a8072efa099874de98222222cdf
BLAKE2b-256 dce9474eb754b7b031c8d7ffeb31cdc1d6984a14eeae0cf26736649f0cc3baf9

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