# Creating a component event

**URL:** <https://forum.inductiveautomation.com/t/creating-a-component-event/30403>\
**Category:** Module Development\
**Tags:** perspective\
**Created:** [December 3, 2019, 1:28pm UTC](https://forum.inductiveautomation.com/t/creating-a-component-event/30403 "2019-12-03T13:28:27Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 10, 2019, 4:05pm UTC](https://forum.inductiveautomation.com/t/creating-a-component-event/30403/9 "2019-12-10T16:05:22Z")

</div>

Apologies - looks like (not sure why) our internal method of parsing the schema for events isn’t used by the public ComponetDescriptor.register hook. What you’ll want to do instead is add a manually constructed ComponentEventDescriptor to your schema; something like this: (just move the `event` key from the schema.json to its own resource file, for simplicity)

```auto
    public static JsonSchema EVENT_SCHEMA =
        JsonSchema.parse(RadComponents.class.getResourceAsStream("/radimage.event.json"));

    public static ComponentEventDescriptor EVENT_DESCRIPTOR = new ComponentEventDescriptor("onActionPerformed", "Fired when an action occurs", EVENT_SCHEMA);

    /**
     * Components register with the Java side ComponentRegistry but providing a ComponentDescriptor. Here we
     * build the descriptor for this one component. Icons on the component palette are optional.
     */
    public static ComponentDescriptor DESCRIPTOR = ComponentDescriptorImpl.ComponentBuilder.newBuilder()
        .withPaletteCategory(RadComponents.COMPONENT_CATEGORY)
        .withPaletteDescription("A simple image component.")
        .withId(COMPONENT_ID)
        .withModuleId(RadComponents.MODULE_ID)
        .withSchema(SCHEMA) // this could alternatively be created purely in Java if desired
        .withPaletteName("Rad Image")
        .withDefaultMetaName("radImage")
        .withEvents(List.of(EVENT_DESCRIPTOR))
        .shouldAddToPalette(true)
        .withResources(RadComponents.BROWSER_RESOURCES)
        .build();

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/creating-a-component-event/30403)._
