Skip to main content

Streamlit Textcomplete - Autocomplete text in any textarea

Streamlit Textcomplete is a custom Streamlit component designed to enhance text input fields with autocomplete functionality. It leverages the powerful textcomplete library to provide users with a seamless and intuitive autocomplete experience within Streamlit applications.

Demo

demo

Example Screencast

Features

  • Autocomplete for Text Areas: Enhance textarea in Streamlit with autocomplete functionality, making data input faster and more accurate.
  • Customizable Strategies: Define your own strategies for text autocomplete, including username mentions, emoji suggestions, and more.
  • Easy Integration: Seamlessly integrates with existing Streamlit applications with minimal setup.
  • Flexible and Extensible: Easily extend the component to support additional autocomplete strategies as per your application's needs.

Installation

To install Streamlit Textcomplete, run the following command in your terminal:

pip install streamlit-textcomplete

Usage

To use Streamlit Textcomplete in your Streamlit application, follow these steps:

  1. Import the [textcomplete] function from the package.
  2. Define your autocomplete (multiple) strategies.
  3. Define standard streamlit textarea but give it a defined label
  4. Initialize the textcomplete component with this label & your strategies.

Example:

import streamlit as st
from textcomplete import textcomplete, StrategyProps

original_label: str = "Textcomplete Example"
txt: str = st.text_area(
    label=original_label,
    key="st_text_area_1",
)
# Define your autocomplete strategies
username_strategy = StrategyProps(
    id="userFullName",
    match="\\B@(\\w*)$",
    search=async_search_function,  # Define your async search function as JS string
    replace="([fullName]) => `${fullName}`",
    template="([fullName]) => `🧑🏻 ${fullName}`",
)

# Initialize the textcomplete component
textcomplete(
    area_label=original_label,
    strategies=[username_strategy],
    max_count=5,
    # Additional options ...
)

Development

To contribute to the development of Streamlit Textcomplete, you can set up a development environment by cloning the repository and installing the dependencies.

git clone https://github.com/voznik/streamlit-textcomplete.git
cd streamlit-textcomplete
pip install -r requirements.txt

Testing

Run the tests to ensure everything is working as expected:

pytest

License

Streamlit Textcomplete is MIT licensed, as found in the LICENSE file.

Acknowledgments

  • This project is built using the Textcomplete library.
  • Special thanks to the Streamlit community for their support and contributions.

Metadata

Release files for streamlit-textcomplete 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamlit-textcomplete 0.2.0
File Size Uploaded Provenance Actions
streamlit_textcomplete-0.2.0.tar.gz 124.9 kB Without provenance Details for streamlit_textcomplete-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for streamlit-textcomplete 0.2.0
File Interpreter ABI Platform Actions
streamlit_textcomplete-0.2.0-py3-none-any.whl Python 3 none any Details for streamlit_textcomplete-0.2.0-py3-none-any.whl

Total release size: 254.8 kB

Release files / streamlit_textcomplete-0.2.0.tar.gz

Download URL streamlit_textcomplete-0.2.0.tar.gz
Size 124.9 kB
Tags Source
SHA-256 checksum
How to use checksums
861b93de5fba2e35b569a68201347bdaf4839034e488ab1ad85a91c7d134ebba
BLAKE2b-256 checksum
How to use checksums
6689f5015b0d6745f9845aa17a66cd004976bd3b9a5041869e2ef67a7f5954c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.10.15 Linux/6.5.0-1025-azure

Release files / streamlit_textcomplete-0.2.0-py3-none-any.whl

Download URL streamlit_textcomplete-0.2.0-py3-none-any.whl
Size 130.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d18df56a61776b36345538dcdfbad1a8878a5590a5f1af604f3de3f4835ca4e3
BLAKE2b-256 checksum
How to use checksums
bc5f7110b2fa578afa4ab937777e1861bc3fc03811834f75b90704604f08e2a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.10.15 Linux/6.5.0-1025-azure

Security for streamlit-textcomplete 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page