Skip to main content

Streamlit component that allows you to use Meta's Lexical rich text editor with tables and everything!

Project description

streamlit-lexical-extended

Streamlit component that allows you to use Meta's Lexical as a rich text plugin. With tables and everything!

It is a spin off of streamlit_lexical.

✨ Features

  • 📝 Rich text editing with Meta's Lexical editor
  • 📊 Full table support with interactive cell editing
  • 🎨 Markdown formatting (bold, italic, headings, lists, quotes)
  • Dynamic height - fixed or auto-expanding modes
  • 🔄 Debounced updates for performance
  • 🎯 TypeScript + React frontend

🚀 Installation

pip install streamlit-lexical-extended

📖 Usage

import streamlit as st
from streamlit_lexical_extended import streamlit_lexical_extended

# Basic usage
result = streamlit_lexical_extended(
    value="# Hello World\n\nStart typing...",
    key="editor1"
)

st.write("Output:", result)

With Fixed Height

result = streamlit_lexical_extended(
    value="Content here...",
    height=400,  # Fixed 400px height
    key="fixed_editor"
)

With Auto-Expand

result = streamlit_lexical_extended(
    value="Content here...",
    min_height=200,  # Minimum 200px, grows with content
    key="auto_editor"
)

With Debouncing

result = streamlit_lexical_extended(
    value="Content here...",
    debounce=500,  # Wait 500ms before updating
    key="debounced_editor"
)

🔧 Parameters

Parameter Type Default Description
value str "" Initial markdown content
height int | None None Fixed height in pixels. If None, auto-expands
min_height int 400 Minimum height for auto-expand mode
placeholder str "Start typing..." Placeholder text
debounce int 300 Debounce delay in milliseconds
key str Required Unique key for the component
overwrite bool False Force overwrite editor content

🛠️ Development

See BUILD_AND_PUBLISH.md for complete build and publish instructions.

Quick Setup

# Clone repository
git clone https://github.com/yourusername/streamlit-lexical-extended.git
cd streamlit-lexical-extended

# Install Python dependencies
pip install -e .

# Install frontend dependencies
cd streamlit_lexical_extended/frontend
npm install
npm run build
cd ../..

# Run example
streamlit run streamlit_lexical_extended/example.py

📦 Building & Publishing

# Build frontend
cd streamlit_lexical_extended/frontend && npm run build && cd ../..

# Build Python package
python -m build

# Upload to PyPI
twine upload dist/*

Or use the automated release script:

./release.sh 0.2.1

📄 License

MIT License

🙏 Credits

Based on streamlit_lexical by Alexander Dickson.

Uses Meta's Lexical editor framework.

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_lexical_extended-0.2.1.tar.gz (755.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_lexical_extended-0.2.1-py3-none-any.whl (767.6 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_lexical_extended-0.2.1.tar.gz.

File metadata

File hashes

Hashes for streamlit_lexical_extended-0.2.1.tar.gz
Algorithm Hash digest
SHA256 51c5dd0e0b6a179422cfa7e38cf250754006a79941e9bf2e2f0286b4cf9b59dc
MD5 3821d8ac407898013516aa2b7d6e1966
BLAKE2b-256 1ac652a75df5cf3b6b5f6cc01e642a74ebd93a388d90258d5fddd86a1f1d4fac

See more details on using hashes here.

File details

Details for the file streamlit_lexical_extended-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_lexical_extended-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 de44fa2278990085fd9214b262b5b378f22d5d5ff14245e61161b71ad9fbd1a3
MD5 0aba2fadd0846ed4322924c25fac0f49
BLAKE2b-256 da6df39fc45ebfba14a3e0ec37312c8a61dfc22f39e999ff8998674a139e5bb3

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