We're transitioning Studio from Beta to Early Availability
Hygraph
Docs

You are currently reading the Studio Docs. If you were looking for the Classic Docs check here

Using enumerations

#Overview

An enumeration is a predefined set of values that represents a list of possible options.

#What you can do

  • You can use enumerations to group values within a type.

  • You can use enumerations to create a list of values and add it to a model. The values can then be selected from a dropdown menu in the content creation screen.

#Create an enumeration

Create an enumerationCreate an enumeration

  1. Navigate to the Schema builder
  2. You can create an enumeration by navigating to the Schema builder, locating enumerations on the Schema list, and then clicking on + Add next to Enumerations on the Schema list, or the + Add Enumerations button located at the center of the screen. The New enumeration screen will display as a result.
  3. Complete the Display name field with the name that will be displayed in Hygraph. The API ID field will be autocompleted when you complete the Display name, but you can edit this value. The API ID is the ID for accessing this enumeration through the API.
  4. Optionally, you can add a Description.
  5. Under enumeration values, you can add a list of values by manually entering the Display name, which autocompletes the API ID field, and then clicking + Add. Your values will display on a list below.
  6. Once you have added all the enumeration values, click Add Enumeration at the bottom of the screen to finish the process.

#Use demo enumeration

Create an enumerationCreate an enumeration

  1. Navigate to the Schema builder.
  2. Click on Add demo enumeration, located at the center of the screen.
  3. The system will generate the demo enumeration and show you the enumeration details screen.

#Delete an enumeration

Delete an enumerationDelete an enumeration

  1. Navigate to the Schema builder.
  2. Click on the enumeration you want to delete.
  3. Click on the context menu to display the Delete option, then click on it to delete the enumeration.

#Add an enumeration to a model

Add an enumeration to a modelAdd an enumeration to a model

  1. Navigate to the Schema builder.
  2. Click on the model you wish to add the enumeration to.
  3. Select the Enumeration field from the Add fields right sidebar.
  4. Complete the Display name field. This will autocomplete the API ID field, but you can edit this value if you want.
  5. Use the Enumeration dropdown to select the enumeration you want to add to this model.
  6. Optionally, you can also add a Description.
  7. This screen allows you to control different properties of your Enumeration field: you can allow multiple values, localize the field, or use it as title field, by selecting the checkboxes under the Field options section of the screen.
  8. Click Add to save.

After an enumeration has been configured for your model, you will be able to use it in the content editor.

Use an enumeration in a content entryUse an enumeration in a content entry