dynamic-forms / Class

PrependArrayItemEvent

Generic types:TTemplate
Implements:FormEvent

Event dispatched to prepend a new item at the BEGINNING of an array field.

Use this when new items should appear at the start of the list. For appending to the end, use {@link AppendArrayItemEvent}.

Constructor

No documentation has been provided.

Presentation
constructor(
	readonly arrayKey: string, 
	readonly template: TTemplate
): PrependArrayItemEvent<TTemplate>;
Parameters
NameTypeDescription
r
arrayKey
string
r
template
TTemplate

Properties

NameTypeDescription
type
r
implements FormEvent
"prepend-array-item"

Example usage

// Object item: prepend { name } object
eventBus.dispatch(arrayEvent('contacts').prepend([
  { key: 'name', type: 'input', label: 'Name' }
]));

// Primitive item: prepend single value
eventBus.dispatch(arrayEvent('tags').prepend(
  { key: 'tag', type: 'input', label: 'Tag' }
));