Iridium CMSIridium CMS

nanoid | uuid | slug

The nanoid, uuid and slug properties are used to assist users with generating identifiers.

Nanoid


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

export const sample = atom('sample', {
  myDate: nanoid(),
});

The nanoid field takes an optional configuration object with the following properties:

  • alphabetstring
    The alphabet used to generate the id. Defaults to the nanoid alphabet.
  • lengthnumber
    The length of the id. Defaults to 21.
  • displayNamestring
    The display name of the field. Defaults to the name of the property.
  • requiredboolean
    Whether the field is required. Defaults to false.
  • searchableboolean
    Whether the field is searchable. Defaults to false.
  • filterableboolean
    Allows filtering the field. Defaults to false.
  • layoutLAYOUT
    The layout of the field in the admin. Defaults to LAYOUT.full.

uuid


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

export const sample = atom('sample', {
  myDate: uuid(),
});

The uuid is used to generate a UUID v4 identifier. It takes an optional configuration object with the following properties:

  • displayNamestring
    The display name of the field. Defaults to the name of the property.
  • requiredboolean
    Whether the field is required. Defaults to false.
  • searchableboolean
    Whether the field is searchable. Defaults to false.
  • filterableboolean
    Allows filtering the field. Defaults to false.
  • layoutLAYOUT
    The layout of the field in the admin. Defaults to LAYOUT.full.

slug


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

export const sample = atom('sample', {
  myDate: slug('myText'),
  myText: text(),
});

The slug is used to generate a url-safe string: lowercase, trimmed without spaces; based on a reference to another text input. The slug value will be automatically kept in sync with the text. It takes an optional configuration object with the following properties:

  • namestring
    The field name of a text field to generate the slug.
  • displayNamestring
    The display name of the field. Defaults to the name of the property.
  • requiredboolean
    Whether the field is required. Defaults to false.
  • searchableboolean
    Whether the field is searchable. Defaults to false.
  • filterableboolean
    Allows filtering the field. Defaults to false.
  • layoutLAYOUT
    The layout of the field in the admin. Defaults to LAYOUT.full.