# How to trigger callback with a click on plot annotation

**URL:** <https://community.plotly.com/t/how-to-trigger-callback-with-a-click-on-plot-annotation/80996>\
**Category:** Dash Python\
**Created:** [December 18, 2023, 4:58am UTC](https://community.plotly.com/t/how-to-trigger-callback-with-a-click-on-plot-annotation/80996 "2023-12-18T04:58:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiteme](https://avatars.discourse-cdn.com/v4/letter/k/d26b3c/32.png) [@kiteme](https://community.plotly.com/u/kiteme)\
**Post date:** [December 18, 2023, 4:58am UTC](https://community.plotly.com/t/how-to-trigger-callback-with-a-click-on-plot-annotation/80996/1 "2023-12-18T04:58:11Z")

</div>

I have a plot with some text annotations, added using fig.add\_annotation(). How can I trigger a callback when the annotation is clicked? clickData property of the graph doesn’t trigger

---

<div class="post-metadata">

**Author:** ![AIMPED](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/aimped/32/21758_2.png) [@AIMPED](https://community.plotly.com/u/AIMPED)\
**Post date:** [December 18, 2023, 9:40am UTC](https://community.plotly.com/t/how-to-trigger-callback-with-a-click-on-plot-annotation/80996/2 "2023-12-18T09:40:27Z")

</div>

Hey @kiteme, there are no events fired when clicking annotations. The only event I know of is the relayoutData if changing a annatation:

Suppose you have a rectangular shape and change it’s dimension or position by dragging the shape.

You could also add an EventListener either JS or [dash-extensions](https://www.dash-extensions.com/components/event_listener) and trigger a callbcak if the click coordinates are within the coordinate range of your annotation.

---

<div class="post-metadata">

**Author:** ![Saratoga](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/saratoga/32/28634_2.png) [@Saratoga](https://community.plotly.com/u/Saratoga)\
**Post date:** [June 18, 2024, 2:30am UTC](https://community.plotly.com/t/how-to-trigger-callback-with-a-click-on-plot-annotation/80996/3 "2024-06-18T02:30:33Z")

</div>

https://codepen.io/saratoga01/embed/preview/MWdQWOL?default-tabs=js%2Cresult&height=300&host=https%3A%2F%2Fcodepen.io&slug-hash=MWdQWOL
