Recipes
Step-by-step checklists for the most common kinds of contributions.
Adding a Field Type
Config schema, class, validator, admin input, column type, tests, and docs.
Adding a TranslationShip a new admin UI language in @nextjscms/translations.
Adding an option to an existing field
The smaller cousin of a new field type. For a field X in core/fields/x.ts:
- Add the option to the field's
configSchema(az.strictObject), with a JSDoc comment and.describe(). - Store it in the class constructor, and apply its default there (
config.foo ?? default). - Use it in the right lifecycle method (
prepareForSubmissionfor validation,exportForClientif the admin input needs it). - If it affects the column, update
generateFieldSQL()(and the comparison logic inupdate-sections.ts) andschema-generator.ts. - Mirror client-side validation in
src/validators/x.ts. - Tests: the field's unit tests, the validator's tests, and schema sync tests if the column changed.
- Document it on the field's page in
apps/docs/content/docs/fields/, with an example. - Add a changeset (
minor).
Adding a section option
- Add it to the section type's
configSchemaincore/sections/<type>.ts(orbaseSectionOptionsSchemafor all types). - Resolve it in the class constructor.
- Consume it where it matters (page builders in
api/actions/pages.ts,FieldFactory, submit, or schema sync). - Document it in the section's page and the options table on Sections.