Skip to main content

A simple component to display annotated text in Streamlit apps.

Project description

Annotated Text component for Streamlit

A simple component to display annotated text in Streamlit apps.


First install Streamlit (of course!) then pip-install this library:

pip install streamlit
pip install st-annotated-text


import streamlit as st
from st_annotated_text import annotated_text

# Annotated text example

Below is an example of how to use the annotated_text function:

    "This ",
    ("is", "verb", "#8ef"),
    " some ",
    ("annotated", "adj", "#faa"),
    ("text", "noun", "#afa"),
    " for those of ",
    ("you", "pronoun", "#fea"),
    " who ",
    ("like", "verb", "#8ef"),
    " this sort of ",
    ("thing", "noun", "#afa"),


The annotated_text() function accepts any of the following arguments:

  • strings, to draw the string as-is on the screen.
  • tuples of the form (main_text, annotation_text, background, color) where background and foreground colors are optional and should be an CSS-valid string such as "#aabbcc" or "rgb(10, 20, 30)"
  • htbuilder.HtmlElement objects in case you want to customize the annotations further. In particular, you can import the annotation() function from this module to easily produce annotations whose CSS you can customize via keyword arguments.

Project details

Download files

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

Files for st-annotated-text, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size st-annotated-text-1.0.1.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page