# Add custom anonymous mode button

**URL:** https://meta.discourse.org/t/add-custom-anonymous-mode-button/135793
**Category:** Support
**Tags:** anonymous-mode
**Created:** [December 12, 2019, 1:35am UTC](https://meta.discourse.org/t/add-custom-anonymous-mode-button/135793 "2019-12-12T01:35:35Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)
#### Post date: [December 12, 2019, 7:04pm UTC](https://meta.discourse.org/t/add-custom-anonymous-mode-button/135793/2 "2019-12-12T19:04:49Z")

</div>

This can be done by using a plugin outlet and adding some handlebars (these concepts are covered in [Developing Discourse Themes & Theme Components](https://meta.discourse.org/t/developer-s-guide-to-discourse-themes/93648))

In your theme (admin \> customize \> themes \> edit CSS/HTML), you can add this to your `</head>` file.

```xml
<script type="text/x-handlebars" data-template-name="/connectors/above-main-container/anon-button">
{{#if this.currentUser}}
  {{#if this.currentUser.is_anonymous}}
    {{d-button class="btn-primary" action=(route-action 'toggleAnonymous') icon="ban" label="switch_from_anon"}}
  {{else}}
    {{d-button class="btn-primary" action=(route-action 'toggleAnonymous') icon="user-secret" label="switch_to_anon"}}
  {{/if}}
{{/if}}
</script>

```

 ![Screen Shot 2019-12-12 at 2.03.57 PM](https://global.discourse-cdn.com/meta/original/3X/1/9/1938cba5c08f0c4c86d97623d657eb48ed56129c.png)

---

_[View the full topic](https://meta.discourse.org/t/add-custom-anonymous-mode-button/135793)._
