Add fields

We will now add some fields to our Product model for a product name, price and image.

To add a field, select one of the field types from the right side of the schema editor.

List of available fields
List of available fields

Create a name fieldAnchor

Select Single line text from the available types and set the Display name to Name.

Configure field name
Configure field name

Then make sure to enable Make field required in the VALIDATIONS tab.

Set field as required
Set field as required

Once you're happy configuring this field, click the Add button.

Add field
Add field

Create a price fieldAnchor

Let's now add another field, but using the Integer type. Select Number from the available types, and set the Display name to Price.

Configure field name
Configure field name

Then make sure to enable Make field required in the VALIDATIONS tab.

Set field as required
Set field as required

Once you're happy configuring this field, click the Add button.

Add field
Add field

Create an image fieldAnchor

We'll now add our final field, and for this we'll use the Asset model as a relation for multiple product photos.

The Asset model is a special type of field that allows us to store images and other files.

Assets are a core feature in Hygraph, and the assets model is added to every new project by default.

Select Asset Picker from the available types and set the Display name to Image. Make sure to also select Allow multiple values:

Configure asset field
Configure asset field

Once you're happy configuring this field, click the Add button.

Add field
Add field

Now your Product model should now look a little something like this:

Product model fields
Product model fields

Explore system fieldsAnchor

Hygraph by default handles system fields for things such as the id, createdAt, publishedAt, and more .

You can see all of the system fields for your selected model by clicking on Show system fields:

Show system fields
Show system fields