Skip to content

[v2]: make fieldComponents less strict to allow grouping #2360

Description

@TkDodo

One thing we still can't do in v2 is attach groupings to our form fields. Like we have <field.Layout.Row> and <field.Layout.Stack> but we can't just add bare objects to fieldComponents on type level so we now make them a component that doesn't do anything and then attach Row and Stack to it:

export function Layout() {
  return null;
}

Layout.Row = ...
Layout.Stack = ...

It works at runtime, I think it's just a type mismatch that fieldComponents expects things that return jsx, but I think it would be great if we could add groups like this:

fieldComponents: {
  Layout: {
    Row, Stack
  }
}

as long as the last thing is a component..

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: typesThis issue affects the types of the library.scope: reactThis issue specifically affects the react adapter.type: enhancementThis requests an enhancement to existing behaviour.v2This issue affects v2 as well.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions