Functionality similar to FormBuilderInput #3538
Unanswered
jfulse
asked this question in
Sanity Studio Support
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! In v2 we have several custom input components that use
FormBuilderInput
, imported from"@sanity/form-builder/lib/FormBuilderInput"
. In general the v3 API is much easier to use (renderInput
,members
etc) but there are some use cases I haven't been able to replicate in v3. Here's one example:We have localized fields modelled as object types: typically
{ nb: "norwegian content", en: "english content", ...}
but not limited to string types; the content in each language can also be portable text etc. Without a custom component this will be rendered as something likeIn v2 we have a custom component that only renders the current language, and without the indentation level corresponding to the key titles ("nb", "en", ...). That is, it looks like the following when the current language is nb:
The custom input component uses
FormBuilderInput
to render the content correctly, be it a string or portable text or whatever.I haven't seen how to to this with v3; from what I can tell there's no way to avoid the extra indent level corresponding to "nb", "en" using
renderInput
,members
and so on.We could make the custom input component from scratch but then we need something like a switch statement on the
type
that renders the correct input; this would be cumbersome and also I'm not sure if the standard input for portable text is exported anywhere.Do you see a solution to this?
Beta Was this translation helpful? Give feedback.
All reactions