Vue 3 template to build a Streamlit component. Uses Vue.js scoped slot to send parameters from Streamlit Python script into args props of your component.
Built with Vite, Vue3 and Typescript to be light and fast.
- Ensure you have Python 3.8+, Node.js, npm and (optionally) yarn installed.
- Generate template from this repo by using
Use this templatebutton on the repo's Github page. - Create a new Python virtual environment for the template using your preferred method.
- Install Streamlit:
$ pip install streamlit
- Initialize and run the component template frontend:
$ cd my_component/frontend
$ yarn install # Install the dependencies
$ yarn run dev # Start the dev server
- From a separate terminal, run the template's Streamlit app:
$ streamlit run my_component/__init__.py
- If all goes well, you should see something like this:

- Modify the frontend code at
my_component/frontend/src/Component.vue.- Parameters passed by Python script are made available in
argsprops.
- Parameters passed by Python script are made available in
- Modify the Python code at
my_component/__init__.py. - Feel free to rename the
my_componentfolder,Component.vuefile with its import inapp.vue, and package name insetup.pyandpackage.json.
When you're ready to publish the component:
- Rename your
my_componentfolder to the name of your component if you haven't done so yet - Pass your component's name in
declare_componentin__init__.py - Change
_RELEASEto True in__init__.py - Edit
MANIFEST.in, change the path for recursive-include frompackage/frontend/dist *to<component name>/frontend/dist * - Edit
setup.pyand provide the relevant info about your component - Run from your
frontendfolder
$ yarn run build
The component is ready to be published. You can follow the tutorials available online on how to build a wheel and publish it to PyPI or it can now be installed directly from github (in which case don't forget to include frontend/dist folder in your repo).