Picker Fields

THIS PAGE
In the graph
In the CMS
In the API

Picker fields are allow you to restrict input from a list of predefined options. This allows the field to contain the information thats populated from a list of options that you configure in the graph. In terms of databases, they are ENUMs.

In the graph

Screenshot

Create a Picker field by creating a new field and marking the input type as Picker. You can then add options in the properties panel of the field.

Additional Properties

Property Description
Picker Options The list of options that you want to restrict input to. Each option is an Object with a label and a value. Read Recipe
Multiple Selection Whether the field can hold multiple items from the linked table
Required Whether the value is a required field. Can be set in the Validations section

Validations

The Picker field only supports validations when multiple selection is on.

Operate On Possible Conditions
Number of Items > , >= ,= ,<= ,< ,

Multiple validations can be chained together with AND operations

See Field Validations for more information on how to add validations.

In the CMS

Screenshot

When you publish a Picker field, it's available in the Content Management System as a dropdown input. The user can select values populated from the options that you defined in the graph.

If the multiselect property is enabled for a field, then the user can select multiple options from the dropdown.

Example: If we have a Genres field in a Movies Table with options such as COMEDY, HORROR, then the dropdown in the CMS for Genres would accept only those inputs.

Screenshot

In the API

In the API the output response for this field is an Object that has fields from the linked table.

Sample GraphQL Request

{
  movies {
    title
    genres {
      # Linked to the Actor table
      label
      value
    }
  }
}

Sample GraphQL Response

{
  "data": {
    "movies": [
      {
        "title": "Superman vs. Spiderman",
        "genres": [
          {
            "label": "Comedy",
            "value": "COMEDY"
          },
          {
            "label": "Science Fiction",
            "value": "SCI_FI"
          }
        ]
      }
    ]
  }
}
Did you find what you were looking for?
👍
👎
What went wrong?
Need more help?We have a thriving Discordcommunity that can help you with all things Canonic. →