Skip to content

How to implement a json schema type for nested accordion fields #1280

Answered by kestarumper
austinh asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @austinh,
There are a few approaches to this and it depends on how much information you want to encode into the schema.
The biggest question is how the fields will know that they belong to the same group and what layout should be used.

The most straightforward approach is to use custom written component that renders an accordion and a group of fields inside it.
Assuming a very simple layout, you could use NestField that will render child fields in a linear manner. E.g.

import { NestField } from 'uniforms-unstyled';

<Accordion>
    <NestField fields={['fieldA', 'fieldB' /* ... */]} grouped showInlineError />;
</Accordion>

or, assuming the the group of fields is indicated as an object t…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@austinh
Comment options

Answer selected by kestarumper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants