-
Notifications
You must be signed in to change notification settings - Fork 685
Custom components v2 #1382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Custom components v2 #1382
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
48696ee
First draft of ccv2 concepts
sfc-gh-dmatthews 4890e2b
Update first three quickstart examples.
sfc-gh-dmatthews 77e02d4
Edits
sfc-gh-dmatthews f829c7d
Validate final quickstart example.
sfc-gh-dmatthews ff87433
Correct file handling for inline components
sfc-gh-dmatthews 613215b
Edits
sfc-gh-dmatthews 5aedeff
Use caching
sfc-gh-dmatthews 92e0fcc
Correct callback behavior
sfc-gh-dmatthews 3879553
Update create.md
sfc-gh-dmatthews ea09fb6
Quotes
sfc-gh-dmatthews 0d8889b
Default parameter and other edits
sfc-gh-dmatthews 310f3f7
Update create.md
sfc-gh-dmatthews 90d0bb0
Format markdown table
sfc-gh-dmatthews add8eb0
Debug form validation
sfc-gh-dmatthews 1b76722
Radial menu state example
sfc-gh-dmatthews cee43b4
Radial menu one-page code
sfc-gh-dmatthews b9a4eec
Danger button
sfc-gh-dmatthews b5ed159
Stopwatch example for combined state/trigger value
sfc-gh-dmatthews c192f23
Update theming.md
sfc-gh-dmatthews 1ec769e
Typos and link corrections
sfc-gh-dmatthews 50f42a7
Merge branch 'main' into ccv2-concepts
sfc-gh-dmatthews 8f48ba0
Update quickstart.md
sfc-gh-dmatthews 2bf6d17
Temp urls
sfc-gh-dmatthews 54df5b9
Update code format
sfc-gh-dmatthews 24d4c73
Update danger button quickstart
sfc-gh-dmatthews 6566ab1
Show embedded app first in quickstart
sfc-gh-dmatthews 14119f6
Create edits
sfc-gh-dmatthews 755097e
Rearchitect CCV2 docs
sfc-gh-dmatthews File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,62 +1,52 @@ | ||
| --- | ||
| title: Components | ||
| title: Custom Components | ||
| slug: /develop/concepts/custom-components | ||
| description: Learn how to build and use custom Streamlit components to extend app functionality with third-party Python modules and custom UI elements. | ||
| keywords: custom components, third-party modules, component development, extend functionality, custom UI, component integration, Streamlit components | ||
| description: Learn about Streamlit custom components - powerful extensions that unlock capabilities beyond built-in widgets using web technologies. | ||
| keywords: custom components, component development, extend streamlit, web components, custom widgets, component architecture | ||
| --- | ||
|
|
||
| # Custom Components | ||
|
|
||
| Components are third-party Python modules that extend what's possible with Streamlit. | ||
| Custom Components are powerful extensions for Streamlit that unlock capabilities beyond the built-in widgets. They let you integrate any web technology—from advanced data visualizations to specialized input controls to complete mini-applications—directly into your Streamlit apps. | ||
|
|
||
| ## How to use a Component | ||
| ## Getting started | ||
|
|
||
| Components are super easy to use: | ||
| <TileContainer> | ||
|
|
||
| 1. Start by finding the Component you'd like to use. Two great resources for this are: | ||
| - The [Component gallery](https://streamlit.io/components) | ||
| - [This thread](https://discuss.streamlit.io/t/streamlit-components-community-tracker/4634), | ||
| by Fanilo A. from our forums. | ||
| <RefCard href="/develop/concepts/custom-components/overview"> | ||
|
|
||
| 2. Install the Component using your favorite Python package manager. This step and all following | ||
| steps are described in your component's instructions. | ||
| <h4>Overview of Custom Components</h4> | ||
|
|
||
| For example, to use the fantastic [AgGrid | ||
| Component](https://github.com/PablocFonseca/streamlit-aggrid), you first install it with: | ||
| Learn what custom components are, when to use them, and understand the differences between v1 and v2 approaches. | ||
|
|
||
| ```python | ||
| pip install streamlit-aggrid | ||
| ``` | ||
| </RefCard> | ||
|
|
||
| 3. In your Python code, import the Component as described in its instructions. For AgGrid, this step | ||
| is: | ||
| <RefCard href="/develop/concepts/custom-components/v1"> | ||
|
|
||
| ```python | ||
| from st_aggrid import AgGrid | ||
| ``` | ||
| <h4>Components v1</h4> | ||
|
|
||
| 4. ...now you're ready to use it! For AgGrid, that's: | ||
| The original custom components framework. Learn how to use and build v1 components. | ||
|
|
||
| ```python | ||
| AgGrid(my_dataframe) | ||
| ``` | ||
| </RefCard> | ||
|
|
||
| ## Making your own Component | ||
| <RefCard href="/develop/concepts/custom-components/v2"> | ||
|
|
||
| If you're interested in making your own component, check out the following resources: | ||
| <h4>Components v2</h4> | ||
|
|
||
| - [Create a Component](/develop/concepts/custom-components/create) | ||
| - [Publish a Component](/develop/concepts/custom-components/publish) | ||
| - [Components API](/develop/concepts/custom-components/intro) | ||
| - [Blog post for when we launched Components!](https://blog.streamlit.io/introducing-streamlit-components/) | ||
| The next generation of custom components with enhanced capabilities, bidirectional communication, and simplified development. | ||
|
|
||
| Alternatively, if you prefer to learn using videos, our engineer Tim Conkling has put together some | ||
| amazing tutorials: | ||
| </RefCard> | ||
|
|
||
| ##### Video tutorial, part 1 | ||
| <RefCard href="/develop/concepts/custom-components/publish"> | ||
|
|
||
| <YouTube videoId="BuD3gILJW-Q" /> | ||
| <h4>Publishing Components</h4> | ||
|
|
||
| ##### Video tutorial, part 2 | ||
| Learn how to package and distribute your custom components to the community. | ||
|
|
||
| <YouTube videoId="QjccJl_7Jco" /> | ||
| </RefCard> | ||
|
|
||
| </TileContainer> | ||
|
|
||
| ## Component gallery | ||
|
|
||
| Explore the [Community Component Gallery](https://streamlit.io/components) to discover components built by the Streamlit community. | ||
62 changes: 62 additions & 0 deletions
62
content/develop/concepts/custom-components/components-v1/_index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| --- | ||
| title: Components v1 | ||
| slug: /develop/concepts/custom-components/components-v1 | ||
| description: Learn how to build and use custom Streamlit components to extend app functionality with third-party Python modules and custom UI elements. | ||
| keywords: custom components, third-party modules, component development, extend functionality, custom UI, component integration, Streamlit components | ||
| --- | ||
|
|
||
| # Custom Components | ||
|
|
||
| Components are third-party Python modules that extend what's possible with Streamlit. | ||
|
|
||
| ## How to use a Component | ||
|
|
||
| Components are super easy to use: | ||
|
|
||
| 1. Start by finding the Component you'd like to use. Two great resources for this are: | ||
| - The [Component gallery](https://streamlit.io/components) | ||
| - [This thread](https://discuss.streamlit.io/t/streamlit-components-community-tracker/4634), | ||
| by Fanilo A. from our forums. | ||
|
|
||
| 2. Install the Component using your favorite Python package manager. This step and all following | ||
| steps are described in your component's instructions. | ||
|
|
||
| For example, to use the fantastic [AgGrid | ||
| Component](https://github.com/PablocFonseca/streamlit-aggrid), you first install it with: | ||
|
|
||
| ```python | ||
| pip install streamlit-aggrid | ||
| ``` | ||
|
|
||
| 3. In your Python code, import the Component as described in its instructions. For AgGrid, this step | ||
| is: | ||
|
|
||
| ```python | ||
| from st_aggrid import AgGrid | ||
| ``` | ||
|
|
||
| 4. ...now you're ready to use it! For AgGrid, that's: | ||
|
|
||
| ```python | ||
| AgGrid(my_dataframe) | ||
| ``` | ||
|
|
||
| ## Making your own Component | ||
|
|
||
| If you're interested in making your own component, check out the following resources: | ||
|
|
||
| - [Create a Component](/develop/concepts/custom-components/create) | ||
| - [Publish a Component](/develop/concepts/custom-components/publish) | ||
| - [Components API](/develop/concepts/custom-components/intro) | ||
| - [Blog post for when we launched Components!](https://blog.streamlit.io/introducing-streamlit-components/) | ||
|
|
||
| Alternatively, if you prefer to learn using videos, our engineer Tim Conkling has put together some | ||
| amazing tutorials: | ||
|
|
||
| ##### Video tutorial, part 1 | ||
|
|
||
| <YouTube videoId="BuD3gILJW-Q" /> | ||
|
|
||
| ##### Video tutorial, part 2 | ||
|
|
||
| <YouTube videoId="QjccJl_7Jco" /> |
2 changes: 1 addition & 1 deletion
2
...cepts/custom-components/components-api.md → ...ponents/components-v1/v1-component-api.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...pts/custom-components/create-component.md → ...ents/components-v1/v1-component-create.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...concepts/custom-components/limitations.md → ...components-v1/v1-component-limitations.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
content/develop/concepts/custom-components/components-v2/_index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| --- | ||
| title: Custom components v2 | ||
| slug: /develop/concepts/custom-components/components-v2 | ||
| description: Learn about Streamlit custom components v2 - the next generation framework with enhanced capabilities, bidirectional communication, and simplified development. | ||
| keywords: custom components v2, next generation components, bidirectional communication, enhanced capabilities, modern component development | ||
| --- | ||
|
|
||
| # Custom components v2 | ||
|
|
||
| Components v2 represents a reimagining of how custom components work in Streamlit. It's designed to unlock new capabilities and dramatically simplify the development experience. For command reference, see the [API Reference](/develop/api-reference/custom-components). | ||
|
|
||
| ## Getting started | ||
|
|
||
| <TileContainer> | ||
|
|
||
| <RefCard href="/develop/concepts/custom-components/components-v2/quickstart"> | ||
|
|
||
| <h4>Quickstart examples</h4> | ||
|
|
||
| Get started quickly with practical examples showing interactive buttons, data exchange, and complete component implementations. | ||
|
|
||
| </RefCard> | ||
|
|
||
| <RefCard href="/develop/concepts/custom-components/components-v2/create"> | ||
|
|
||
| <h4>Create components</h4> | ||
|
|
||
| Learn the basics of registering and mounting v2 components with inline development. | ||
|
|
||
| </RefCard> | ||
|
|
||
| <RefCard href="/develop/concepts/custom-components/components-v2/state-and-triggers"> | ||
|
|
||
| <h4>State vs triggers</h4> | ||
|
|
||
| Understand the two communication mechanisms for building interactive components. | ||
|
|
||
| </RefCard> | ||
|
|
||
| <RefCard href="/develop/concepts/custom-components/components-v2/theming"> | ||
|
|
||
| <h4>Theming & styling</h4> | ||
|
|
||
| Make your components look great with Streamlit's theme integration and CSS custom properties. | ||
|
|
||
| </RefCard> | ||
|
|
||
| <RefCard href="/develop/concepts/custom-components/components-v2/package-based"> | ||
|
|
||
| <h4>Package-based components</h4> | ||
|
|
||
| Build complex components with modern frontend tooling, TypeScript, and external dependencies. | ||
|
|
||
| </RefCard> | ||
|
|
||
| </TileContainer> | ||
|
|
||
| ## Migration from v1 to v2 | ||
|
|
||
| If you have existing v1 components, check out these migration examples: | ||
|
|
||
| - [streamlit-bokeh v2 migration](https://github.com/streamlit/streamlit-bokeh/pull/40) | ||
| - [streamlit-pdf v2 migration](https://github.com/streamlit/streamlit-pdf/pull/25) | ||
|
|
||
| ## What's next? | ||
|
|
||
| Ready to build your first v2 component? Start with the [Quickstart examples](/develop/concepts/custom-components/components-v2/quickstart) to see practical implementations, then dive into the [Create components](/develop/concepts/custom-components/components-v2/create) guide to learn the fundamentals. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.