building-streamlit-custom-components-v2

Installation
SKILL.md

Building Streamlit custom components v2

Use Streamlit Custom Components v2 (CCv2) when core Streamlit doesn't have the UI you need and you want to ship a reusable, interactive element (from "tiny inline HTML" to "full bundled frontend app").

CRITICAL: CCv2 only — NEVER use v1 APIs

Custom Components v1 is deprecated and removed. Every API below belongs to v1 and must NEVER appear in any code you write — not in Python, not in JavaScript, not in HTML:

Banned Python APIs (v1):

  • st.components.v1 — the entire v1 module
  • components.declare_component() — v1 registration
  • components.html() — v1 raw HTML embed

Banned JavaScript patterns (v1):

  • Streamlit.setComponentValue(...) — v1 global; use setStateValue() / setTriggerValue() instead
  • Streamlit.setFrameHeight(...) — v1 global; CCv2 handles sizing automatically
  • Streamlit.setComponentReady() — v1 global; CCv2 has no ready signal
  • window.Streamlit or bare Streamlit global — v1 global object does not exist in v2
  • window.parent.postMessage(...) — v1 iframe communication; CCv2 does not use iframes
Related skills

More from streamlit/agent-skills

Installs
3
GitHub Stars
186
First Seen
Mar 28, 2026