Iridium CMSIridium CMS

Elements (pages)

Elements are a type of atom that are used to define reusable, creatable instances of content, such as blog posts, articles, or pages. An element is a template for content creation.

Creating an Element

The element 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 { element, text, relation, components } from '@iridiumcms/core';

export const page = element('page', {
  title: text(),
  description: text(),
  hero: relation('hero'),
  content: components([
    'headline',
    'richtext',
  ]),
});

Element names should be singular and describe the type of content that will be created. For example, a blog post would be an element named post.

Elements are exposed under the elements path of the API and are surfaced as creatable content in the admin under "Elements".