# Mogelijk om event handlers aan widgets te koppelen in thema/plugin?

**URL:** <https://meta.discourse.org/t/possible-to-attach-event-handlers-to-widgets-in-theme-plugin/166204>\
**Category:** Development\
**Created:** [4 oktober 2020 om 15:42 UTC](https://meta.discourse.org/t/possible-to-attach-event-handlers-to-widgets-in-theme-plugin/166204 "2020-10-04T15:42:58Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![dchouinard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dchouinard/32/194662_2.png) [@dchouinard](https://meta.discourse.org/u/dchouinard)\
**Post date:** [4 oktober 2020 om 16:15 UTC](https://meta.discourse.org/t/possible-to-attach-event-handlers-to-widgets-in-theme-plugin/166204/4 "2020-10-04T16:15:13Z")

</div>

Additionally: a little confused here, but how do I find the “widget” associated with a particular UI element? (in my case: the widget powering topic-list-item showing an individual topic in a topic list). From [the widget directory](https://github.com/discourse/discourse/tree/master/app/assets/javascripts/discourse/app/widgets), none seem related to topic-list-item. [This “component”](https://github.com/discourse/discourse/blob/52672b9eabccb1184d85dc7f08062d5a7c18cb73/app/assets/javascripts/discourse/app/components/topic-list-item.js) seems to be instead be responsible for rendering topic-list-item.

Not clear about the distinction between widgets and components (apologies for not being more familiar) — presumably it’s only possible to attach event handlers with `api.attachWidgetAction` to “widgets” but not to “components”. Is there an equivalent for components?

---

_[View the full topic](https://meta.discourse.org/t/possible-to-attach-event-handlers-to-widgets-in-theme-plugin/166204)._
