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

Uploaded Source

Built Distribution

searchbar_component-0.1.9-py3-none-any.whl (449.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: searchbar_component-0.1.9.tar.gz
  • Upload date:
  • Size: 446.1 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.9.tar.gz
Algorithm Hash digest
SHA256 b91b4184c7defe565293316a8a72b46b7788d6307ecbca0c36bcfe6b11a1d45f
MD5 69995105b1fcdd53252e272a9876f93a
BLAKE2b-256 951db80b9ec84c87fb022ba056931723470dbf7f33e0ad7b90a86bed4d3e8cde

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for searchbar_component-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 18252a914ca97113e31e7ac73dfb5b1c0a9b09c5b410161af53798f48b3190b7
MD5 78cef457d56f75385b397f17928b6e4a
BLAKE2b-256 9b69e53600e0b0f1ba15bf3d7c2f7936ed5f7d89c8c60491fc7401a7db9e9665

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