st-annotated-text
A simple component to display annotated text in Streamlit apps.
What it is and what it does
st-annotated-text is a Streamlit component that renders text with inline annotations—labels, highlights, or custom styling applied to specific words or phrases. It wraps htbuilder to generate HTML markup and integrates into Streamlit apps via the annotated_text() function.
You pass the function a mix of plain strings and tuples; each tuple contains text to annotate plus a label, and optionally CSS color strings for background and foreground. The component renders the result as styled HTML in your UI. It's designed for scenarios where you need to highlight and label portions of text inline without building custom HTML yourself.
Use it for:
- Display named entity recognition results with entity type labels on extracted text
- Highlight parts of speech or grammatical annotations in linguistic analysis tools
- Show sentiment or topic labels on text passages in data exploration dashboards
- Visualize text classification predictions with category labels
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Displays annotated text with labels and optional styling in Streamlit apps, accepting strings, tuples with annotations, or htbuilder elements for flexible markup.
Yes, if you're building a Streamlit app that needs to display annotated or labeled text. Low install friction, no security issues, and permissive license make it straightforward. Dormant maintenance is not a blocker for a stable, single-purpose component; verify color customization and rendering work with your Streamlit version.
Install
st-annotated-text on PyPI
pip
pip install st-annotated-textuv
uv add st-annotated-textpoetry
poetry add st-annotated-textInstalling st-annotated-text
Before you install
Low friction: pure Python wheel with a single runtime dependency (htbuilder). Dormant maintenance status—last commit January 2025—but stable and suitable for a single-purpose component.
License in practice
Apache 2 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install st-annotated-text
from st_annotated_text import annotated_text
annotated_text(
"This ",
("is", "verb"),
" some ",
("annotated", "adj"),
("text", "noun")
)
Designed for use within Streamlit applications; requires Streamlit to be installed separately.
Verify before relying
- Whether background and foreground color customization works reliably across Streamlit versions
- Performance characteristics with large annotated text blocks or many annotations
- Integration requirements and compatibility with current Streamlit releases
Package facts
| License | Apache 2 (permissive) |
| Python support | supports the current Python release (>=3.5) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — htbuilder |
| Maintenance | dormant — 568 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 301,592/month — #7,834 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: st_annotated_text-4.0.2-py3-none-any.whl
Tags
More HTML packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
lxmllxml provides Python bindings to libxml2 and…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
MarkdownConverts Markdown text to HTML using a Python…
permissive · top 1,000 on PyPI
streamlit-aceEmbeds an Ace code editor component into…
permissive · top 15,000 on PyPI
streamlit-pdf-viewerStreamlit component that renders PDF documents…
unclear · top 15,000 on PyPI
streamlit-pdfAdds a PDF viewer component to Streamlit apps…
permissive · top 15,000 on PyPI
streamlit-code-editorEmbeds an interactive code editor component…
unclear · top 15,000 on PyPI
streamlit-feedbackAdds a user feedback widget to Streamlit apps…
permissive · top 15,000 on PyPI
st-themeDetects and returns the active theme (light or…
permissive · top 15,000 on PyPI
streamlit-embedcodeEmbeds code snippets from external services…
unclear · top 15,000 on PyPI
streamlit-quillEmbeds a React Quill rich-text editor component…
unclear · top 15,000 on PyPI
streamlit-avatarRenders clickable avatar icons with images,…
unclear · top 15,000 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI