# Sidebar User Field Toggle

**URL:** https://meta.discourse.org/t/sidebar-user-field-toggle/257634
**Category:** Theme component
**Created:** [March 9, 2023, 6:07pm UTC](https://meta.discourse.org/t/sidebar-user-field-toggle/257634 "2023-03-09T18:07:19Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [March 9, 2023, 6:07pm UTC](https://meta.discourse.org/t/sidebar-user-field-toggle/257634/1 "2023-03-09T18:07:20Z")

</div>

| | | |
| --- | --- | --- |
| ℹ | **Summary** | Add toggles into new sidebar |
| 🛠 | **Repository** | [GitHub - Lhcfl/sidebar-user-field-toggle: Add toggles into new sidebar · GitHub](https://github.com/Lhcfl/sidebar-user-field-toggle) |
| ❓ | **Install Guide** | [How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) |
| 📖 | **New to Discourse Themes?** | [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) |

Install this theme component

> **Special thanks to @Kinetiksoft on Discourse Meta for supporting me in developing this theme component. Without @Kinetiksoft, this theme component would not exist.**

This theme component allows you to add a set of buttons to the sidebar to adjust user fields.

![image](https://global.discourse-cdn.com/meta/original/4X/c/3/9/c390976ef4446f3f378719e63b4d57c059050bc0.png)

 ![image](https://global.discourse-cdn.com/meta/original/4X/0/d/4/0d43ea18062176e4edbe3a87a9428ca9066db9b5.png)  
 ![image](https://global.discourse-cdn.com/meta/original/4X/9/f/f/9ff2ce425e49c1eb9884c6c8bb25affdb1d96b70.png)

## Additional instructions for developers

The theme component sends an AppEvent when the button is pressed and when it is loaded for the first time.

If you need to perform an action when the button is pressed, use `api.onAppEvent("sidebar_user_fields_toggled", (e) => { ... });`

```javascript
    // Use `api.onAppEvent("sidebar_user_fields_toggled", (e) => { ... });`
    // to handle button toggle event
    this.appEvents.trigger("sidebar_user_fields_toggled", { user_fields });

```

---

_[View the full topic](https://meta.discourse.org/t/sidebar-user-field-toggle/257634)._
