Skip to content
D
Documentation

PropertyDefinition

reference
1 min readUpdated

Import it from @grafloria/renderer.

Definition of a single property in a property schema

This is the core interface that defines how a property should be edited in the UI. Each property definition specifies:

  • What property key it maps to in the NodeModel
  • How it should be displayed (label, description)
  • What editor component to use
  • Validation rules
  • Conditional visibility
  • Grouping and ordering
ts
interface PropertyDefinition

Properties

NameTypeDefaultDescription
keystringProperty key in NodeModel (must match the property name)
labelstringDisplay label shown in UI
editorPropertyEditorTypeEditor type to use for this property
defaultValue?anyDefault value if property is not set
description?stringHelp text or tooltip description
validation?PropertyValidationValidation rules for this property
condition?PropertyConditionConditional visibility based on other property values
group?stringGroup name for organizing properties (optional)
order?numberDisplay order within group (default: definition order)
display?PropertyDisplayOptionsDisplay options and hints for the editor

Example

Basic string property

typescript
const prop: PropertyDefinition = {
  key: 'name',
  label: 'Name',
  editor: 'string',
  validation: { required: true, minLength: 3 }
};

Example

Number property with validation

typescript
const prop: PropertyDefinition = {
  key: 'port',
  label: 'Port',
  editor: 'number',
  validation: { min: 1, max: 65535 },
  defaultValue: 8080
};

Example

Conditional property

typescript
const prop: PropertyDefinition = {
  key: 'customColor',
  label: 'Custom Color',
  editor: 'color',
  condition: { property: 'useCustomColor', operator: '==', value: true }
};

Was this page helpful?

PropertyDefinition — Grafloria