How to Contribute Components?
warning
This page may contain outdated information. It will be updated as soon as possible.
New components are added as objects of the CustomComponent class and any dependencies are added to the pyproject.toml file.
Add an example component
You have a new document loader called MyCustomDocumentLoader and it would look awesome in Langflow.
- Write your loader as an object of the CustomComponent class. You'll create a new class,
MyCustomDocumentLoader
, that will inherit fromCustomComponent
and override the base class's methods. - Define optional attributes like
display_name
,description
, anddocumentation
to provide information about your custom component. - Implement the
build_config
method to define the configuration options for your custom component. - Implement the
build
method to define the logic for taking input parameters specified in thebuild_config
method and returning the desired output. - Add the code to the /components/documentloaders folder.
- Add the dependency to /documentloaders/__init__.py as
from .MyCustomDocumentLoader import MyCustomDocumentLoader
. - Add any new dependencies to the outer pyproject.toml file.
- Submit documentation for your component. For this example, you'd submit documentation to the loaders page.
- Submit your changes as a pull request. The Langflow team will have a look, suggest changes, and add your component to Langflow.
User Sharing
You might want to share and test your custom component with others, but don't need it merged into the main source code.
If so, you can share your component on the Langflow store.
- Register at the Langflow store.
- Undergo pre-validation before receiving an API key.
- To deploy your amazing component directly to the Langflow store, without it being merged into the main source code, navigate to your flow, and then click Share. The share window appears:
![Docusaurus themed image](/img/add-component-to-store.png)
![Docusaurus themed image](/img/add-component-to-store.png)
- Choose whether you want to flow to be public or private. You can also Export your flow as a JSON file from this window. When you're ready to share the flow, click Share Flow. You should see a Flow shared successfully popup.
- To confirm, navigate to the Langflow Store and filter results by Created By Me. You should see your new flow on the Langflow Store.