Hi! I'm extremely new to Prismic and NextJS. In fact, I only decided to get into it after discovering Christian Laufenböck's beautiful work for Lot61 earlier this week.
So far, I'm really impressed with SliceMachine, but there's one thing I'm missing right out of the gate: the ability to repeat grouped fields. For instance, if I want to build a Statistics slice like this, and make it flexible so it can have anywhere between 2-4 statistics...
...I would ideally have a repeatable group of 2 Key Text fields (Value and Label) for each stat.
I see a similar question was also asked in 2021, so I'm actually surprised this option hasn't been requested more?
Welcome to the Prismic community and that great feedback.
As mentioned in the linked threads, it is not possible to embed group fields inside another group field, but there are many alternatives to doing 2 levels deep structure using Slices + groups.
So for me, the easiest way to achieve what you want to that is to do is to:
- create a custom type single or repeatable "slider"
- inside this custom type, you can create a Slice field "slider item"
- this slice has a group field that contains the sub items and an image field for the background.
And then, you can link to slider documents using the content relation field, where you can refer to from the pages where you want to display a slider on your website and fetch the data on your front using FetchLinks or GraphQuery.