{"id":13682381,"url":"https://github.com/streamlit/component-template","last_synced_at":"2025-05-14T15:09:13.263Z","repository":{"id":41247448,"uuid":"277638551","full_name":"streamlit/component-template","owner":"streamlit","description":"Templates and example code for creating Streamlit Components","archived":false,"fork":false,"pushed_at":"2024-12-11T18:16:27.000Z","size":2815,"stargazers_count":492,"open_issues_count":20,"forks_count":235,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-04-05T19:04:27.491Z","etag":null,"topics":["streamlit"],"latest_commit_sha":null,"homepage":"https://streamlit.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/streamlit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-06T20:09:13.000Z","updated_at":"2025-04-04T04:42:17.000Z","dependencies_parsed_at":"2023-01-22T18:00:57.480Z","dependency_job_id":"b9f721c6-8f2f-43fa-9ad0-4bef539ca40b","html_url":"https://github.com/streamlit/component-template","commit_stats":{"total_commits":86,"total_committers":18,"mean_commits":4.777777777777778,"dds":0.6627906976744187,"last_synced_commit":"ed8acaedfd0c44b5d5865469a6e6eb266a359459"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamlit%2Fcomponent-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamlit%2Fcomponent-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamlit%2Fcomponent-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamlit%2Fcomponent-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamlit","download_url":"https://codeload.github.com/streamlit/component-template/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631430,"owners_count":21136552,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["streamlit"],"created_at":"2024-08-02T13:01:45.140Z","updated_at":"2025-05-14T15:09:13.256Z","avatar_url":"https://github.com/streamlit.png","language":"Python","readme":"# Streamlit Component Templates\n\nThis repo contains templates and example code for creating [Streamlit](https://streamlit.io) Components.\n\nFor complete information, please see the [Streamlit Components documentation](https://docs.streamlit.io/en/latest/streamlit_components.html)!\n\n## Overview\n\nA Streamlit Component is made out of a Python API and a frontend (built using any web tech you prefer).\n\nA Component can be used in any Streamlit app, can pass data between Python and frontend code, and can optionally be distributed on [PyPI](https://pypi.org/) for the rest of the world to use.\n\n- Create a component's API in a single line of Python:\n\n  ```python\n  import streamlit.components.v1 as components\n\n  # Declare the component:\n  my_component = components.declare_component(\"my_component\", path=\"frontend/build\")\n\n  # Use it:\n  my_component(greeting=\"Hello\", name=\"World\")\n  ```\n\n- Build the component's frontend out of HTML and JavaScript (or TypeScript, or ClojureScript, or whatever you fancy). React is supported, but not required:\n\n  ```tsx\n  import React from 'react';\n  import {\n    withStreamlitConnection,\n    ComponentProps,\n  } from 'streamlit-component-lib';\n\n  function MyComponent({ args }: ComponentProps) {\n    // Access arguments from Python via `props.args`:\n    const { greeting, name } = args;\n    return (\n      \u003cdiv\u003e\n        {greeting}, {name}!\n      \u003c/div\u003e\n    );\n  }\n\n  export default withStreamlitConnection(MyComponent);\n  ```\n\n## Quickstart\n\n- Ensure you have [Python 3.9+](https://www.python.org/downloads/), [Node.js](https://nodejs.org), and [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) installed.\n- Clone this repo.\n- Create a new Python virtual environment for the template:\n  ```bash\n  $ cd template\n  $ python3 -m venv venv  # create venv\n  $ . venv/bin/activate   # activate venv\n  $ pip install streamlit # install streamlit\n  ```\n- Initialize and run the component template frontend:\n  ```bash\n  $ cd template/my_component/frontend\n  $ npm install    # Install npm dependencies\n  $ npm run start  # Start the Vite dev server\n  ```\n- From a separate terminal, run the template's Streamlit app:\n  ```bash\n  $ cd template\n  $ . venv/bin/activate  # activate the venv you created earlier\n  $ pip install -e . # install template as editable package\n  $ streamlit run my_component/example.py  # run the example\n  ```\n- If all goes well, you should see something like this:\n  ![Quickstart Success](quickstart.png)\n- Modify the frontend code at `my_component/frontend/src/MyComponent.tsx`.\n- Modify the Python code at `my_component/__init__.py`.\n\n## Examples\n\nSee the `template-reactless` directory for a template that does not use [React](https://reactjs.org/).\n\nSee the `examples` directory for examples on working with pandas DataFrames, integrating with third-party libraries, and more.\n\n## Community-provided Templates\n\nThese templates are provided by the community. If you run into any issues, please file your issues against their repositories.\n\n- [streamlit-component-svelte-template](https://github.com/93degree/streamlit-component-svelte-template) - [@93degree](https://github.com/93degree)\n- [streamlit-component-vue-vite-template](https://github.com/gabrieltempass/streamlit-component-vue-vite-template) - [@gabrieltempass](https://github.com/gabrieltempass)\n- [streamlit-component-template-vue](https://github.com/andfanilo/streamlit-component-template-vue) - [@andfanilo](https://github.com/andfanilo)\n- [streamlit-component-template-react-hooks](https://github.com/whitphx/streamlit-component-template-react-hooks) - [@whitphx](https://github.com/whitphx)\n\n## Contributing\n\nIf you want to contribute to this project, `./dev.py` script will be helpful for you. For details, run `./dev.py --help`.\n\n## More Information\n\n- [Streamlit Components documentation](https://docs.streamlit.io/library/components)\n- [Streamlit Forums](https://discuss.streamlit.io/tag/custom-components)\n- [Streamlit Components gallery](https://www.streamlit.io/components)\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamlit%2Fcomponent-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamlit%2Fcomponent-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamlit%2Fcomponent-template/lists"}