Skip to content

Add <Field /> component to render a single field outside of a form #4371

@ferretwithaberet

Description

@ferretwithaberet

Prerequisites

What theme are you using?

antd

Is your feature request related to a problem? Please describe.

I would love the ability to render a singular field using RJSF. This would be useful for places where you are supposed to give in a singular field.
For example, using ant design pro components's ProTable, if you want to specify the filter component (component shown in the filter form above the table) you have to specify one singular component that takes care of filtering that column of data, but I want to request this data from the backend as a JSON schema (and UI schema) and render the fields based on what the backend gave me.

Describe the solution you'd like

I would see this done through 3 components:

  • RJSF Provider;
  • RJSF Form;
  • RJSF Field.

The <Provider /> component would provide common logic to both Form and Field (like the available widgets).

The <Form /> component would work as it works right now, except, if it has a provider above it, it will take some props from there (like widgets).

The <Field /> component would take a schema (and an UI schema) for a single field, for example:

{
  "type": "integer",
  "min": 1,
  "max": 5
}

and a UI schema like

{
  "ui:widget": "stars",
  "ui:color": "yellow"
}

and render a singular field.

Describe alternatives you've considered

Creating my own mapping of components that I allowed my backend to render.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions