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:

  1. Click the Schema tab to open the Schema Editor.
  2. Then, click the + Create enumeration button.
  3. 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.

  1. Add each of the list values and click the Save button. The Display name values are visible to content editors.

create enumeration

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.

  1. Add a List field to the model or component. Check out the model and component docs for more details.
  2. From the Select enumeration dropdown, choose your enumeration.

Add List field

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.