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:
- alphabetThe alphabet used to generate the id. Defaults to the nanoid alphabet.
string - lengthThe length of the id. Defaults to
number21. - displayNameThe display name of the field. Defaults to the name of the property.
string - requiredWhether the field is required. Defaults to
booleanfalse. - searchableWhether the field is searchable. Defaults to
booleanfalse. - filterableAllows filtering the field. Defaults to
booleanfalse. - layoutThe layout of the field in the admin. Defaults to
LAYOUTLAYOUT.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:
- displayNameThe display name of the field. Defaults to the name of the property.
string - requiredWhether the field is required. Defaults to
booleanfalse. - searchableWhether the field is searchable. Defaults to
booleanfalse. - filterableAllows filtering the field. Defaults to
booleanfalse. - layoutThe layout of the field in the admin. Defaults to
LAYOUTLAYOUT.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:
- nameThe field name of a text field to generate the slug.
string - displayNameThe display name of the field. Defaults to the name of the property.
string - requiredWhether the field is required. Defaults to
booleanfalse. - searchableWhether the field is searchable. Defaults to
booleanfalse. - filterableAllows filtering the field. Defaults to
booleanfalse. - layoutThe layout of the field in the admin. Defaults to
LAYOUTLAYOUT.full.
