Skip to content

Custom Components in Gradio #1432

@abidlabs

Description

@abidlabs

Converted to a tracking + discussion issue for custom components.

Context

to follow

Parts

  • FE support for arbitrary components being loaded + mounted

    • A way to register components of any description internally (no user impact)
    • A consistent (versioned) interface for components + access to app level metadata (minor)
  • BE support for custom components

    • A way to generate a component for use in gradio (minor)
    • A consistent interface for all components (args, classes to extend, methods that must be present, urils etc that can be used by authors (di or import))
  • A way to share custom components

    • See theme sharing proposal
    • More complex than themes as the JS etc cannot be generated by the BE and passed to the frontend
    • Svelte or any? Build process? action/ build server?
  • A way to consume custom components

    • APIs
    • CDN or self host?
  • DX

    • how will a user develop and test their custom component?
    • How will a user use theme values such that their custom component will automatically be themed when a user passes in a new theme?
    • Can be make utils/ components/ whatever available to users as building blocks for their components?
    • How do we document all of this stuff?

I envisage many kinds of custom components:

  • fully custom with a new python + html/js/css
    • either extending from existing gradio components or fully custom implementations
  • pure frontend components that use some gradio python class. Basically a new frontend for existing components
  • Pure python components.
    • Something like the above, composition for components with a new interface
    • or new python implementation for an existing component that will use an existing frontend. (Maybe is changes stuff like preprocessing or w/e)

These are the core usecases I think we need to cover.

More detail to follow

Original

We've heard requests from many different places (Discord, #1410) on folks who want to create plugins / custom components in Gradio. We should think about how we want to support this (do we want plugins that are not part of the main library?) and write up a Guide showing how to contribute these kinds of pulgins / components.

cc @pngwn

Metadata

Metadata

Labels

brainstormingBrainstorming issuenew componentInvolves creating a new component

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions