Skip to content

Custom properties

Property definitions drive the properties sidebar. You can add new properties (persisted into the structure JSON automatically) or override built-in ones.

Add to every element

ts
provideNgxViewBuilderExtensions({
  globalProperties: {
    trackingId: {
      label: 'Tracking ID',
      type: 'text',
      category: 'general',
      hint: 'Analytics identifier rendered as data-tracking-id.',
    },
  },
});

Add or override per element type

ts
provideNgxViewBuilderExtensions({
  elementProperties: {
    button: {                       // element type
      analyticsEvent: {             // new property
        label: 'Analytics event', type: 'text', category: 'general',
      },
      label: { hidden: true },      // hide a built-in property
    },
  },
});

Runtime equivalents: api.registerElementProperties(type, props), api.registerGlobalElementProperties(props), api.registerElementPropertiesMap(map).

Property definition fields

FieldPurpose
labelCaption in the sidebar
typeWhich editor renders it (table below)
categorySidebar section: general, texts, dataSet, options, columns, restrictions, validators, logic, events, design
orderPosition within the category
hintHelp text under the editor
choicesOptions for select-style editors ({ label, value }[])
hiddenIfExpression over sibling properties — hides the editor conditionally (e.g. !maskType || maskType.value != "custom")
applyConditionsOther property keys to re-evaluate when this one changes
sectionOptional sub-grouping inside a category
componentA custom Angular editor component (fully custom editors)
loadChoicesAsync choice loader (properties) => Promise<ChoiceModel[]>

Editor types

The type string picks one of the built-in attribute editors:

TypeEditor
text / textarea / numberplain inputs
checkboxboolean toggle
selectdropdown (uses choices)
colorcolor picker
sizesize with units (px/%/…)
paddingfour-sided padding editor
optionsoption-list editor (label/value rows)
validatorsvalidators rule editor
eventActionsevents & actions editor
sourceMapperdata source binding editor
variantRulesconditional variant rules
columns / tableColumnscolumn schema editors
htmlCodecode editor
filefile picker
checklist, logic, templateName, sourceName, and othersspecialised editors used by built-in elements

For anything unique, supply your own component — it receives the property and element context and writes the value back like any built-in editor.

How values reach the element

A property with key analyticsEvent is stored on the element JSON as "analyticsEvent": ... and appears on the model at runtime (model().analyticsEvent in your component, getElementProperty(name, 'analyticsEvent') from the host).

Property hints

To only clarify existing properties (no structural change), set hint texts from the host:

ts
api.setPropertyHints({ name: 'Unique key — becomes the data field name.' });
api.setPropertyTypeHints({ sourceMapper: 'Binds this element to a data source.' });