How to create a page builder with repeater functionality in Sanity.io
Last updated: Jan 5, 2023
Hi, I am testing out Sanity after coming from WP and im looking to be able to build a page builder that is just as good as the ones I create using Advanced Custom Fields for WordPress. So far Sanity has been super easy to work with and it looks like most of the functionality im looking for is here except for the ability to add a "repeater" inside a "repeater". I believe the closest element to this on Sanity is the "array" field, but I can't seem to put another inside of it. Is there anyway to get this functionality?
Jan 5, 2023, 1:57 AM
You can’t put an array inside of an array, unfortunately. You can, however, wrap the array inside of an object, then put that object in an array!
Jan 5, 2023, 2:08 AM
I don't think I understand what you mean. Any chance you could show me an example? Let's say I want to build in a way that clients would be able to create as many lists as they want, select a title for each list, add as many list items as they want
Jan 5, 2023, 2:35 AM
You can read more about the limitations of arrays here , as well as see examples of how to handle it.