building-streamlit-custom-components-v2

Build bidirectional Streamlit Custom Components v2 with st.components.v2.component.

629|85|Updated May 4, 2020
One-click install
npx skills add https://github.com/andfanilo/streamlit-echarts --skill building-streamlit-custom-components-v2
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: building-streamlit-custom-components-v2
Source: https://github.com/andfanilo/streamlit-echarts/tree/main/.claude/skills/developing-with-streamlit/skills/building-streamlit-custom-components-v2
Command: npx skills add https://github.com/andfanilo/streamlit-echarts --skill building-streamlit-custom-components-v2

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a structured approach to building bidirectional Streamlit Custom Components v2 (CCv2) using st.components.v2.component, enabling richer UI and robust stateful interactions.

Core Features & Use Cases

  • Inline HTML/CSS/JS components with rapid iteration for small to medium components.
  • Packaged CCv2 projects via the official template for production readiness and distribution.
  • Theming and state/trigger wiring across frontend and Python, plus guidance on asset_dir, globs, and Vite-based workflows.

Quick Start

Start with an inline CCv2 example (HTML/JS/CSS strings), then migrate to a packaged component using the official template.

Frequently Asked Questions about building-streamlit-custom-components-v2

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build bidirectional Streamlit custom components with state wiring?

Build bidirectional Streamlit custom components using st.components.v2.component to wire state and triggers across frontend and Python. This skill guides inline HTML/CSS/JS strategies and packaged component workflows for robust stateful interactions.

What is the difference between inline and packaged Streamlit CCv2 components?

Inline Streamlit CCv2 components use HTML/CSS/JS strings for rapid iteration on small components, while packaged components use the official template with asset_dir and globs for production readiness and distribution.

How do I apply theming to custom components in Streamlit using Vite?

Apply theming to custom components in Streamlit by utilizing --st-* CSS tokens within your Vite-based workflow. This skill provides guidance on wiring these theme tokens across frontend and Python for consistent UI styling.

Do I need the official component-template v2 to package a Streamlit custom component?

You need the official component-template v2 to package a Streamlit custom component for production distribution. It supports Vite bundling, asset_dir manifests, and frontend/backend wiring, though inline components work for rapid iteration without it.

Why are my Streamlit custom component frontend triggers not updating the backend state?

Streamlit custom component frontend triggers fail to update backend state when bidirectional wiring is incomplete. This skill addresses wiring state and triggers correctly using st.components.v2.component to ensure robust frontend-backend synchronization.

Can I bundle Streamlit packaged custom components with Vite?

You can bundle Streamlit packaged custom components with Vite using the component-template v2. This workflow supports asset_dir manifests, globs, and best practices for frontend/backend wiring to achieve production readiness.