Skip to content

Inspector controls

The inspector (right panel) is built from a schema of accordion groups, each containing controls. Use these in a custom block's inspector array.

Control catalog

typeEditsNotes
texta stringsingle-line input
textareaa stringmulti-line input
numbera numbermin, max, step, unit (clamps to min on blur)
slidera numbermin, max, step
colora color stringswatch + hex; supports transparent
selecta valuerequires options
align'left' | 'center' | 'right'alignment toggle
togglea booleanswitch
spacingpadding objecttop/right/bottom/left with link
borderborder objectwidth / style / color
fonta font objectfont-family picker
linkhref objectURL + (optional) target
imageimage objectURL + upload via onImageUpload
backgroundbackground objectcolor / image
listarray of itemsitemKind: 'social' | 'menu'

ControlDef

ts
interface ControlDef {
  type: ControlType
  key: string          // value key within the node's `values` (dotted keys ok)
  label?: string
  min?: number
  max?: number
  step?: number
  unit?: string
  options?: SelectOption[]   // for `select`
  placeholder?: string
  itemKind?: 'social' | 'menu'  // for `list`
}

interface SelectOption {
  label: string
  value: string | number
}

Example group

ts
inspector: [
  {
    title: 'Style',
    controls: [
      { type: 'font',   key: 'fontFamily', label: 'Font' },
      { type: 'number', key: 'fontSize',   label: 'Size', unit: 'px', min: 8, max: 80 },
      { type: 'select', key: 'fontWeight', label: 'Weight', options: [
        { label: 'Regular', value: '400' },
        { label: 'Bold',    value: '700' },
      ] },
      { type: 'color',  key: 'color',      label: 'Color' },
      { type: 'align',  key: 'align',      label: 'Align' },
      { type: 'spacing', key: 'padding',   label: 'Padding' },
    ],
  },
]

Dotted keys

A control's key can address a nested value — e.g. padding.top edits just the top of a padding object while leaving the rest intact.

Released under the MIT License.