Iridium CMSIridium CMS

Molecules (templates)

Molecules are similar to elements. They are used to define referenceable subcontent that can be used across multiple elements, such as hero images and calls to action.

Creating a Molecule

The molecule function is used to define the atom. The first argument is the name of the atom, and the second argument is an object that defines the fields.


import { molecule, blockText, media, bool } from '@iridiumcms/core';

export const hero = molecule('hero', {
  richText: blockText(),
  media: media(),
  cover: bool(),
});

Molecule names should be singular and describe the type of content that will be created.

Molcules are exposed under the molecules path of the API and are surfaced as creatable content in the admin under "Molecules".