Iridium CMSIridium CMS

component | components

The component and components properties are used to define an atom relationship.

These definitions can be static, where a property references another atom, or dynamic, where a property can have one-or-many components.

When defining a static relationship, the component will be pre-generated in the admin.

Component


import { atom, component } from '@iridiumcms/core';

export const sample = atom('sample', {
  myCta: component('cta'),
});

The component field takes either an atom name and optional configuration object or a optional configuration object:

  • namestring
    The name of the atom to reference.
  • displayNamestring
    The display name of the field. Defaults to the name of the property.
  • showLabelboolean
    Set to false to hide the property name in the admin. Defaults to true.
  • requiredboolean
    Whether the field is required. Defaults to false.
  • isStaticboolean
    Set to false to make the property optional and disable the admin from pre-generating the component structure.
  • layoutLAYOUT
    The layout of the field in the admin. Defaults to LAYOUT.full.

Components


import { atom, components } from '@iridiumcms/core';

export const sample = atom('sample', {
  myCtas: components('cta'),
  myContent: components([
    'headline',
    'feature',
    'boxes',
  ]),
});

The components field takes atom references as an allow list. The admin will only allow the user to create components that are defined in the names array. This is similar to repeaters in other content management systems.

  • an string of an atom name
  • an array of atom names
  • an object with the following properties:

  • namesstring | string[]
    The name(s) of the atom(s) to allow.
  • isRepeatableboolean
    Allows multiple of the same component to be created. Defaults to true.
  • minnumber
    The minimum number of components to create. Defaults to 0.
  • maxnumber
    The maximum number of components to create. Defaults to Infinity.
  • displayNamestring
    The display name of the field. Defaults to the name of the property.
  • showLabelboolean
    Set to false to hide the property name in the admin. Defaults to true.
  • requiredboolean
    Whether the field is required. Defaults to false.
  • isStaticboolean
    Set to false to make the property optional and disable the admin from pre-generating the component structure.
  • layoutLAYOUT
    The layout of the field in the admin. Defaults to LAYOUT.full.