Enumerations
This article explains how to create and use an enumeration in Prepr. An enumeration is a predefined list of values that can be used in models and components.
Create an enumeration
To create an enumeration, follow these steps:
- Click the Schema tab to open the Schema Editor.
- Then, click the + Create enumeration button.
- Fill in a unique Name value for the enumeration.
Note
The value of the API ID is automatically generated. This field is important for the GraphQL API to connect your front end to Prepr. When you create a new enumeration, this name is generated as follows: PascalCase version of the Name, stripped of all non-alphanumeric characters. For example, the Name value of Days of the week
generates DaysOfTheWeek
.
- Add each of the list values and click the Save button. The Display name values are visible to content editors.
Once your enumeration is created, it's ready for you to use in a model or component.
Add the enumeration to a model or component
Go to the model or component where you want to include the enumeration and follow the steps below.
- Add a List field to the model or component. Check out the model and component docs for more details.
- From the Select enumeration dropdown, choose your enumeration.
And that's it. You've successfully included your enumeration in a model or component.
Note
To prevent schema integrity issues and impact to existing content items, you cannot update an enumeration once it has been set in a List field in your model or component.