# How do I use api.registerTopicFooterButton?

**URL:** https://meta.discourse.org/t/how-do-i-use-api-registertopicfooterbutton/346651
**Category:** Development
**Tags:** plugin-api
**Created:** [January 11, 2025, 2:42pm UTC](https://meta.discourse.org/t/how-do-i-use-api-registertopicfooterbutton/346651 "2025-01-11T14:42:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [January 11, 2025, 2:42pm UTC](https://meta.discourse.org/t/how-do-i-use-api-registertopicfooterbutton/346651/1 "2025-01-11T14:42:05Z")

</div>

As mentioned in:

> <https://github.com/discourse/discourse/blob/88a4a7f4f0112b5e9643e69039474e97c4a12c09/app/assets/javascripts/discourse/app/lib/plugin-api.gjs#L1403>

What do I put in `action`, if I wish to register a DButton there, that perhaps does an action as specified in the DButton’s `@action`?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 11, 2025, 7:16pm UTC](https://meta.discourse.org/t/how-do-i-use-api-registertopicfooterbutton/346651/2 "2025-01-11T19:16:12Z")

</div>

Clone [GitHub - discourse/all-the-themes · GitHub](https://github.com/discourse/all-the-themes)

run `./reset-all-repos`

```
grep -r registerTopicFooterButton 

```

Find these examples:

```plaintext
official/discourse-custom-topic-button-component/common/head_tag.html: api.registerTopicFooterButton({
official/discourse-quick-whisper/javascripts/discourse/initializers/discourse-quick-whisper.js: api.registerTopicFooterButton({
official/discourse-topic-group-button-component/javascripts/discourse/api-initializers/topic-group-button.js: api.registerTopicFooterButton({

```

> [@NateDhaliwal](#):
>
> What do I put in `action`

What do you want to happen when they click the button?

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [January 12, 2025, 12:40am UTC](https://meta.discourse.org/t/how-do-i-use-api-registertopicfooterbutton/346651/3 "2025-01-12T00:40:40Z")

</div>

Let’s say, redirect the user to `/about`?  
Wait: do I put the `@action` I specified into there? So if I have an action called `redirectUserToAbout`, I put `action`: `action(context) { this.redirectUserToAbout() }`?

Edit: Looks like we have a great example here:  
[https://github.com/discourse/discourse-custom-topic-button-component/blob/main/common/head\_tag.html](https://github.com/discourse/discourse-custom-topic-button-component/blob/main/common/head_tag.html)
