Skip to content
Source
Sign inSign up
TanStack/form

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

OpenTkDodo opened this issue 0 comments
TkDodocommented

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..

  1. LeCarbonator(GitHub profile, opens in a new tab) added labelstype: enhancement

  2. LeCarbonator(GitHub profile, opens in a new tab) added labelsscope: react

  3. LeCarbonator(GitHub profile, opens in a new tab) added labelsarea: types

Sign in to join this conversation.