Skip to main content

Streamlit Component for Comments

Project description

Streamlit Comments Component

This component display comments / notes in your app. I am using it in combination with a streamlit form to collect user feedback. The feedback is saved in an sql table.

Check out the live demo!

Installation

To install st_comments, you can use pip:

pip install st_comments

Usage

To use the st_comments component, you just need to import it in your Streamlit script and call it like any other Streamlit function:

from st_comments import st_comments
def st_comments(comments,delete_keyword="", max_height="500px",custom_css="",key="st_comments",min_height="100px",
                custom_font_awesome_url = "https://kit.fontawesome.com/c7cbba6207.js", delete_user="all")

Parameters

  • comments: List of comments to be displayed. Default: []
#Example Input:
comments = [
    {"id": 1, "user": "User 1", "date": "2023-01-01", "text": "Comment 1"},
    {"id": 2, "user": "User 2", "date": "2023-01-02", "text": "Comment 2"},
    {"id": 3, "user": "User 3", "date": "2023-01-03", "text": "Comment 3"},
     {"id": 4, "user": "User 1", "date": "2023-01-01", "text": "Comment 1"},
    {"id": 5, "user": "User 2", "date": "2023-01-02", "text": "Comment 2"},
    {"id": 6, "user": "User 3", "date": "2023-01-03", "text": "Comment 3"},
]
  • delete_keyword: Text that will be displayed in the delete button (accepts HTML). Default: ""

  • max_height: Maximum height of the component. Default: "500px"

  • custom_css: Custom CSS to be applied to the table. Can just be a string like .MuiTableCell-root {color:red;} Default: "". The text will be rendered in <style> tags above the component.

  • key: Key of the component. Default: "st_comments"

  • min_height: Minimum height of the component. Default: "100px"

  • custom_font_awesome_url: URL of the font awesome library. Default: "https://kit.fontawesome.com/c7cbba6207.js".

  • delete_user: If "all", all users can delete all comments. If "own", users can only delete their own comments. Default: "all", if "none" no comments can be deleted

Note worthy

"Deleting" a will not actually delete anything. What happens is that the comments will not be visible in the frontend anymore and that the component returns a the orginial input with the deleted comment missing.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

st_comments-0.0.6-py3-none-any.whl (3.7 MB view details)

Uploaded Python 3

File details

Details for the file st_comments-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: st_comments-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 3.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for st_comments-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 89c26975f62b20235300dcca3d11ef68e1ca671ba0887ffde7725aa387219663
MD5 c8d398ad92c61a3120e5ef3088a26bb4
BLAKE2b-256 9d040ef609744bbc8f964fe9a89ded91ba2ca1c00e46d0737cb90ed4b39c0fec

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