Creating a component event

First, you’ll want to add the event to your schema.json, assuming you’re using one; provide an events array that has at least a name and description, and as much schema information as applicable, if you’re passing contextual information:

From there, it depends on which side you’re firing this event from. From the frontend, your component props will have a componentEvents, which is an instance of…ComponentEvents - that class has a fireComponentEvent function that accepts an event name and a payload.

If you want to fire a component event from the Java side, you’ll need to register a custom ModelDelegate - from there, the Component instance your delegate receives will have a fireEvent method that takes three arguments, one of which will be the static EventConfig.COMPONENT_EVENTS.

2 Likes