Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Explains building a custom CMS field type via a fluent model-builder API, with DI factory registration and TypeScript module augmentation.
27% 100%+73 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 6 of 22 without it.
3 of 3 safety checks passed
12 agent runs
A custom field type is a class that extends DataFieldBuilder<"yourType">, paired with a factory class implementing FieldType.Factory. Register the factory with container.register(YourFieldType). Add a module augmentation on "webiny/api/cms/model" so the fields registry method gets TypeScript autocomplete.
Use a custom field type when:
text, number, boolean, datetime, file, ref, object, richText, longText, json, dynamicZone)fields.slug(), fields.color()) in ModelFactory implementationsA custom field type consists of three parts:
DataFieldBuilder<"type"> plus FieldTypeValidator.* typesthis.validation() for each validatorFieldType.Factory, creates builder instancesAs a standalone extension (not part of a larger feature), the directory layout is:
extensions/
└── SlugFieldType/
├── SlugFieldType.ts # builder interface, builder class, factory class
└── feature.ts # createFeature — registers the factory into the DI container
feature.ts:
// extensions/SlugFieldType/feature.ts
import { createFeature } from "webiny/api";
import { SlugFieldType } from "./SlugFieldType.js";
export const SlugFieldTypeFeature = createFeature({
name: "SlugFieldType",
register(container) {
Next to this one in the catalogue, plus more from the same author.