Skip to content

Allow registering custom widgets #63

@n1k0

Description

@n1k0

Self-explanatory dream API:

import Form from "react-jsonschema-form";

const MyComponent = (props) => {
  // ....
};

const schema = {
  type: "string"
};

const widgets = {
  myComponent: MyComponent
};

const uiSchema = {
  "ui:widget": "myComponent"
};

render((<Form 
  schema={schema} 
  uiSchema={uiSchema} 
  widgets={widgets}
/>), document.querySelector("main"))

Context: as uiSchema should be defined using JSON (and no necessarily JavaScript), we need to expose a way to register a custom component and associate it with a string unique identifier we can later reference from the JSON definition.

/cc @leplatrem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions