Is it possible to add dynamic fields to a content type? For example, I add a boolean type to a content type. If the user chooses the true/yes option, then another content field appears for the user to add additional data? Is this currently possible in Prismic? If not is this a feature that could be in planning?
Unfortunately conditional dynamic fields like this aren’t available in Prismic at the moment. I’ve added a tick to our feature request tracker to let the team know of your interest in this.
A good solution for your use case would be to use our slices feature.
You could create whatever building blocks you want to give you content creators and then the can choose from that list what they need to build the page layouts they desire.
Here’s some information to show how to template slices in your project:
These are the JS docs but the same article is in the other technologies.
We are working on a feature that can work for some of the uses cases of conditional fields.
I will be really interested in the use case that you’re having. Do you have some details that you can share? Maybe mockups that will explain the context of your need for this feature ?
It might also be interesting that we present you some of our early work, if it fits your use case.
Thanks a lot.
Heads up, the slices picker is going to get CLUTTERED and hard to choose from soon.
My little shop alone can think of 40 different widgets that we want included on a “web page” content type, and it’s going to get hard to navigate.
Also, might be cool to allow users to upload their own svgs for slice icons.
I also have the need for conditional fields. The suggestion above to use slices does not help us much, because we use the slices on a higher level of abstraction.
One of my specific use cases is a two column layout that can be filled with text and images.
There are some general fields such as a background for the entire columned layout and then there are specific fields for each column. Depending on what type of column it is, e.g. image or text, the user should fill out different fields.
Since the conditional fields are not available yet I solve this by adding more information to the fields, to indicate which fields are relevant for each column type. However, this soon becomes hard to keep track of and I become reluctant to add more fields, even though it would be useful. The user experience would be much better if we could have a conditional field that added some fields. You could draw inspiration from how fragments work in Graphql.
Dynamic content fields would also be super useful for us at Monito, happy to test the feature you aer working on @renaud or to share some of our user-cases.