Ga naar hoofdinhoud

CnChipsFieldWidget

A list of short strings in one array field of the CURRENT object, drawn as chips and added and removed in place. Registered under the chips-field widget type.

A portal's "Zonder goedkeuring voor deze e-maildomeinen", "Mag ingesloten worden op" and "Talen" are this shape. Every add and remove is ONE PATCH of that field with the full new list.

Content shape​

{
"id": "portal-domains-auto",
"type": "chips-field",
"title": "Zonder goedkeuring",
"content": {
"field": "autoApproveDomains",
"label": "Zonder goedkeuring voor deze e-maildomeinen",
"addLabel": "Domein",
"confirmLabel": "Toevoegen",
"lowercase": true,
"pattern": "^[a-z0-9-]+(\\.[a-z0-9-]+)+$",
"patternMessage": "Dit is geen domeinnaam."
}
}
KeyMeaning
fieldThe top-level array-of-strings field (required).
label, hint, placeholderTexts, translated through cnTranslate.
addLabel, confirmLabel, removeLabelThe "+ add" chip text, the add button text (default "Add") and the remove button's name (default "Remove").
pattern, patternMessageChecked on every typed entry before any request.
lowercaseStores entries in lower case.
options[{ value, label }]: the add chip offers the options not yet stored instead of free text; chips show the label. Use it for languages.
readOnlyNo add chip, no remove buttons.

Behaviour​

  • An entry is trimmed, then refused with a message before any request when it is empty, fails the pattern or is already in the list.
  • A refused PATCH shows the server's own words and keeps the chips as stored.

Props​

PropTypeDefaultDescription
contentobject{}The configuration above.
objectDataobjectnullThe current detail-page object; the list is read from objectData[field].
objectIdstring|number''The object id, for the PATCH url.
registerstring|object''Register slug of the surface, for the PATCH url.
schemastring|object''Schema slug of the surface, for the PATCH url.

Events​

EventPayloadDescription
saved{ field, value }After a successful PATCH, with the list as the server returned it.

Notes​

  • Content-only on the detail page: it gets the titled card; inside a sections widget it renders bare.
  • For a list of OBJECTS drawn as rows, use field-list.
  • Renderer only: no config form.