Fields


In the Fields modal, you can add a new field to your collection.

fields

Don't forget to save each new fields you create.

Save Fields

Field Types

Contentrain will auto-generate new components for each field type on your database on Git.

Example:

When you select date as the field type, your component will adapt according to the date format.

TypeDescriptionRequired
StringFor any text-based types.optional
ArrayNested array object types.optional
BooleanReturn true of falseoptional
NumberReturn numbers like 37 or -9.25.optional
RelationConnect your other content as an object.optional

Relation Field Type

You can use Relation field type to connect your other content as an object.

Example:

If you want to add multiple select relational contents as blog post tags or categories to your collection:

Create a new Tag collection as an array type.

Tag Array

Create a new PostTags field as a relation type on the same collection and choose your relation content ID's on modal.

Tags Modal

And now, you can select your tags.

Select Tags

It allows you to get time information in hour and minute (HH-MM /AM-PM) format from the user. It returns a string value.

Field Components

TypeDescriptionRequired
ColorProvide a user interface element that lets a user specify a color as RGB / HSL / HEX formats. Returns string.optional
CheckboxProvide a user interface element that lets a user choose a checkbox. Returns boolean.optional
CountData in digit format that can be updated with +/- 1 Returns number.optional
DateRepresent a single moment in time in a platform-independent format, like (2022-04-28 12:00) (YYYY-MM-DD HH-MM). Returns string. See date format and time zone conversions here.optional
DurationIt allows you to get time information in hour and minute (HH-MM /AM-PM) format from the user. Returns string.optional
NumberNumerical format. Returns number.optional
PercentNumerical format as a percentage. Returns number.optional
EmailEmail input fields.optional
Long TextMulti-line input field. Returns string.optional
MediaUsing for image or video assets.optional
Phone NumberPhone number input fields. Returns string.optional
RatingIt allows you to receive data from the user with a selection in the range of 1-5. Returns number.optional
Rich Text EditorFor WYSIWYG rich text editor. Also support Markdown syntax.optional
Single Line TextSingle-line input field. Returns string.optional
SwitchCheckbox as a toggle. Returns boolean.optional
URLURL input fields. Returns boolean.optional

Add your fields and click on Done

Edit this page on GitHub Updated at Fri, Aug 12, 2022