Create and register a custom component.

Function signature[source]

st.components.v1.declare_component(name, path=None, url=None)

Parameters

name (str)

A short, descriptive name for the component. Like, "slider".

path (str or None)

The path to serve the component's frontend files from. Either path or url must be specified, but not both.

url (str or None)

The URL that the component is served from. Either path or url must be specified, but not both.

Returns

(CustomComponent)

A CustomComponent that can be called like a function. Calling the component will create a new instance of the component in the Streamlit app.

forum

Still have questions?

Our forums are full of helpful information and Streamlit experts.