Skip to main content

Streamlit component for taking user input

Project description

streamlit_custom_input

input_example

Streamlit custom chat input box, it returns the value entered by the user on enter or by clicking on the button. To add a new line the user can press shift+enter. The parameters are as follow:

Args:

initialValue (string, optional): 
    The initial value that will be displayed in the input box

key (string, optional): 
    Uniquely identifies the input instance. Defaults to "ChatInput".

inputStyle (dict, optional): 
    Allows the customization of the input box style with CSS. 
    The values that can be changed and their default values are 
    {
        paddingLeft: "10px", 
        paddingRight: "10px",
        whiteSpace: "pre-line", 
        resize: "none", 
        marginLeft: "0", 
        marginRight: "10px",
        paddingBottom: "3px", 
        width: "75%", 
        borderRadius: "1rem", 
        maxBlockSize: "75px", 
        borderColor: "#f4efff", 
        backgroundColor: "#fcf9ff"
    }.
    
buttonStyle (dict, optional): 
    Allows the customization of the input button style with CSS. 
    The values that can be changed and their default values are 
    {    
        width: "55px", 
        borderRadius: "3rem", 
        paddingRight: "5px", 
        paddingTop: "3px", 
        paddingLeft: "9px", 
        display: "flex", 
        justifyContent: "center", 
        backgroundColor: "#edf1ff", 
        color: "#5b5b5c",
        height: "33px"
    }.

Returns: string

Installation instructions

pip install streamlit_custom_input

Usage instructions

Example of how to use without customization

import streamlit as st

from streamlit_custom_input import ChatInput

value = ChatInput(initialValue="", key="input")

Example of how to use with customization

import streamlit as st

from streamlit_custom_input import ChatInput

value = ChatInput(initialValue="", key="input", inputStyle={"backgroundColor":"black"}, buttonStyle={"height":"50px"})

For more example please check the app.py

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

streamlit_custom_input-0.1.1.tar.gz (784.0 kB view details)

Uploaded Source

File details

Details for the file streamlit_custom_input-0.1.1.tar.gz.

File metadata

  • Download URL: streamlit_custom_input-0.1.1.tar.gz
  • Upload date:
  • Size: 784.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.0

File hashes

Hashes for streamlit_custom_input-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2298e8f82c1e9a15fbf6164a6d3f4dff1a61827dd367bcc7d7eb25adec2292d8
MD5 4d109872b4e7a4e6d38d1849f39e51c9
BLAKE2b-256 8e8fb91c954365d3296867ee1be26e6e2e90eea15b91a5cb4960bd1fae4aa43c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page