Frequently Asked Questions

Product Information & Card Grid Recipe

What is the "Card grid with references" recipe in Hygraph?

The "Card grid with references" recipe is a guide for building a card grid component in Hygraph that uses reference fields to relate content entries (such as products, blogs, or stores) to a grid. This allows you to display related content as cards, customize the number of columns, set the gap size between cards, and choose a theme. It's ideal for visually organizing and presenting related entries in your project, such as showcasing products or blog posts. Learn more.

What are the prerequisites for using the card grid with references recipe?

To use this recipe, you need a Hygraph account and an existing project. You can create a new project, clone the provided Card Grid Cookbook project, or use your own project. Plan limits may apply, so review your plan details before adding the recipe. For onboarding, see the Getting Started Tutorial.

How do references work in the card grid recipe?

References in Hygraph are relations between content entries. In the card grid recipe, you create a reference field that allows you to link entries from multiple models (e.g., Product, Blog, Store) to the grid. This enables you to display these related entries as cards within the grid. The reference is typically one-way and allows multiple entries per grid for flexibility. Read more about references.

What schema elements are used in the card grid with references?

The card grid with references uses several schema elements:

These elements allow for flexible configuration and reuse of the card grid component. Learn more about components.

Can I clone an example project for the card grid recipe?

Yes, Hygraph provides a Card Grid Cookbook project that you can clone. This project contains all the card grid recipes, allowing you to compare different configurations and see working examples. Clone the project here.

What are enumerations and how are they used in the card grid?

Enumerations in Hygraph are predefined sets of values used to group options within a type. In the card grid recipe, enumerations are used for selecting the gap size between cards (e.g., Large, Medium, Small) and the theme. This enables easy customization of the grid's appearance. Learn more about enumerations.

How do I add the card grid with references to my existing Hygraph project?

You can add the card grid by following the step-by-step guide:

  1. Create enumerations for styling options (gap size, theme).
  2. Create the models you want to reference (e.g., Product, Blog, Store).
  3. Create the card grid component and add fields for columns, references, gap, and theme.
Adjust the schema as needed for your project. For details, see the step-by-step guide.

Features & Capabilities

What are the main features of the card grid with references component?

The main features include:

Can I reuse the card grid component across different models?

Yes, the card grid component is designed to be reusable. Once created, you can add it to different models in your Hygraph project, allowing you to display related content as cards in various contexts.

What are the customization options for the card grid?

You can customize the card grid by setting the number of columns, choosing the gap size between cards (Large, Medium, Small), and selecting a theme. These options are managed through number fields and enumerations in the schema.

Implementation & Support

Where can I find more resources or get help with the card grid recipe?

You can find more resources in the official Hygraph documentation, including guides on enumerations, components, and references. For community support or to suggest new recipe ideas, join the Hygraph Community Slack.

Are there plan limits I should consider when adding the card grid recipe?

Yes, plan limits may affect the number of models, components, or reference fields you can add. Review your current plan details to ensure compatibility before implementing the recipe.

General Hygraph Platform Questions

What is Hygraph?

Hygraph is a GraphQL-native Headless CMS that enables businesses to build, manage, and deliver digital experiences at scale. It offers features like content federation, Smart Edge Cache, and a user-friendly interface for both technical and non-technical users. Learn more about Hygraph.

Who can benefit from using Hygraph?

Hygraph is ideal for developers, product managers, and marketing teams in industries such as ecommerce, automotive, technology, food and beverage, and manufacturing. It is especially valuable for organizations looking to modernize legacy tech stacks, scale content operations, and deliver consistent digital experiences globally. See use cases.

Security & Compliance

What security and compliance certifications does Hygraph have?

Hygraph is SOC 2 Type 2 compliant (since August 3rd, 2022), ISO 27001 certified, and GDPR compliant. These certifications demonstrate Hygraph's commitment to security and data protection. See security details.

Getting Started & Onboarding

How easy is it to get started with Hygraph?

Hygraph offers a free API playground, a free forever developer account, and a structured onboarding process with introduction calls, account provisioning, and technical/content kickoffs. Extensive documentation and training resources (webinars, live streams, how-to videos) are available to help you get started quickly. Explore documentation.

Support & Community

What support options are available for Hygraph users?

Hygraph provides 24/7 support via chat, email, and phone, real-time troubleshooting through Intercom chat, a community Slack channel, extensive documentation, and training resources. Enterprise customers receive a dedicated Customer Success Manager. See support resources.

Additional Resources

Where can I find more documentation about enumerations, components, and references in Hygraph?

Official documentation is available for enumerations, components, and references to help you implement and customize your schema effectively.

Help teams manage content creation and approval in a clear and structured way
Hygraph
Docs

#Card grid with references

#Overview

This guide shows how to build a card grid component that uses reference fields to relate content to an entry.

This card grid contains a number field so you can indicate how many columns the grid should have, a reference field that lets you relate content entries in your project as cards, and dropdown menus to select the size of the gap between cards and the theme.

Here is an example that shows how this card grid could potentially look on your frontend:

Example card gridExample card grid

It is a good option when you need to show content entries in your project as cards. A good example of this would be a card grid showing related entries, such as products.

Card grid with referencesCard grid with references

#Prerequisites

  • REQUIRED: You need to have a Hygraph account. If you don't have one, you can sign up here.
  • REQUIRED: You need to have a Hygraph project.
    • OPTION 1: Create a project. This is the way to go if you want to follow the entire tutorial for learning purposes.
    • OPTION 2: Clone the cookbook project. This is the way to go if you're curious about how the card grids are made but don't want to follow the step-by-step creation process. This project contains the entire Card Grid Cookbook so you can compare them, or look into what instances they contain.
    • OPTION 3: Use an existing project of yours. If you have a project already and want to add this card grid to it, this is the way to go. In this case, you may need to adjust parts of the tutorial to your own project schema.

#Core concepts

  • Enumerations: An enumeration is a predefined set of values that represents a list of possible options. You can use them to group values within a type.

  • References: References are relations between two or more content entries in your project. With references, you can reuse content entries by connecting them. Once the relation is configured, you can also use it to create related content from the content creation screen.

  • Component: a predefined set of fields that can be reused across models and content entries. You can think of a component as a flexible, reusable template: you define the fields that will be used inside a component once, and then fill them with different content every time you use it in a content entry.

#What you can do

This guide offers two paths:

  • Path 1: Use this guide to create a card grid component that you can reuse across different models in your Hygraph projects.
  • Path 2: Clone the project that contains the entire Card Grid cookbook to compare the different card grid configurations without having to clone multiple projects.

#Clone project

We have prepared a project that contains the entire Card Grid cookbook:

Clone this project

This cookbook contains all the recipes we have so far to create card grids, so you can compare the different card grid configurations without having to clone multiple projects.

To find this particular recipe in the cookbook project, navigate to the schema and look for "Card Grid - References".

This project also contains a demo model that includes all the card grid components in the cookbook as basic component fields, as well as a modular component field that you can use as a card grid type selector.

#Step-by-step guide

Before we can build components, we sometimes need to create other schema elements that will later be added to those components as instances. We will divide this process in steps to make it more manageable:

  1. Create the enumerations: We will need to create enumerations so that we can later on use dropdown menus to select different styling options.
  2. Create models: We will create three models so that we can select them as referenceable by the grid.
  3. Create the card grid: Finally, we'll combine all the elements we worked on before to our card grid.

#1. Create the enumerations

We will start by creating an enumeration that we can later add to our card grid component as a dropdown menu to select the gap size between our cards on the grid.

We'll navigate to our project schema,click +Add next to Enumerations, and use the following information to create our enumeration:

FieldInput
Display NameCards gap
API IDCardsGap

We'll click Add enumeration to save.

Card grid with references - Cards gap enumerationCard grid with references - Cards gap enumeration

Next, we need to add enumeration values. For every enumeration value, we need to enter a Display name, an API ID, and click Add.

We'll add the following values:

Display nameAPI ID
Largelarge
Mediummedium
Smallsmall

Finally, we'll click Add enumeration to save.

Card grid with references - Cards gap enumeration valuesCard grid with references - Cards gap enumeration values

#2. Create models

This card grid configuration will use references to link entries from models in our schema.

FieldInput
Display NameProduct
API IDProduct
API ID PluralProducts

Card grid with references - ModelsCard grid with references - Models

We'll click Add model to save.

Next, we'll create our second content model using the following information:

FieldInput
Display NameBlog
API IDBlog
API ID PluralBlogs

We'll click Add Model to save.

And one final time for our third model:

FieldInput
Display NameStore
API IDStore
API ID PluralStores

We'll click Add model to save.

These are the three content models that we will include in our reference when we create the card grid.

#3. Create the card grid

At this point, we've created everything we need in order to start working on our card grid component.

We'll click +Add next to Components and use the following information:

FieldInput
Display NameCard Grid - References
API IDCardGridReferences
API ID PluralCardGridReferencess

Card grid with references - ComponentCard grid with references - Component

We'll click Add component to save. We can now start adding instances to this component.

Let's start with a Number field, which we can later use to indicate the number of columns on our grid.

We'll find it on the Add fields right sidebar, click on it, and use the following information:

TabFieldInput
SettingsDisplay NameColumns
SettingsAPI IDcolumns
ValidationsMake field required checkboxSelect this checkbox

Card grid with references - Number of columnsCard grid with references - Number of columns

We'll click Add to save.

Earlier, we created three empty content models. We will now add them as part of a Reference field so when we use the card grid component, we will be able to relate content entries from those models. The entries we reference will be included as cards in our grid.

We'll find the Reference field on the Add fields right sidebar, click on it, and use the following information:

TabFieldInput
DefineReference typeSelect Allow multiple models to be referenced (Union Type)
DefineModels to referenceUse the dropdown menu to select Product, Blog and Store
DefineReference directionSelect One-way reference
DefineAllow multiple... checkboxSelect Allow multiple Product, Blog, Store per CardGridReferences
Configure referenceDisplay NameCards
Configure referenceAPI IDcards

Card grid with references - Reference fieldCard grid with references - Reference field

We'll click Add to save.

The final step will be to add Enumeration fields so we can later select the gap size between cards and the theme.

Let's start with the gap size. We'll find the Enumeration field on the Add fields right sidebar, and use the following information to create it:

TabFieldInput
SettingsDisplay NameCards gap
SettingsAPI IDcardsGap
SettingsEnumerationSelect "Cards gap" from the dropdown menu

Card grid with references - GapCard grid with references - Gap

We'll click Add to save.

Finally, we'll repeat the process to add the theme enumeration field:

TabFieldInput
SettingsDisplay NameTheme
SettingsAPI IDtheme
SettingsEnumerationSelect "Theme" from the dropdown menu

Card grid with references - ThemeCard grid with references - Theme

We'll click Add to save.

We've created a card grid component that contains several schema elements for customization purposes and that lets us add existing content entries as cards.

Card grid with referencesCard grid with references

This guide helped you create the schema element yourself. Alternatively, you can clone a project containing all our card grid recipes.

Check out the next document section for that!