# Précisions sur l'attribut Widget

**URL:** <https://meta.discourse.org/t/widget-attribute-clarifications/82870>\
**Category:** Development\
**Created:** [Mars 13, 2018, 3:55 UTC](https://meta.discourse.org/t/widget-attribute-clarifications/82870 "2018-03-13T03:55:21Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)\
**Post date:** [Mars 13, 2018, 3:55 UTC](https://meta.discourse.org/t/widget-attribute-clarifications/82870/1 "2018-03-13T03:55:21Z")

</div>

As I have been continuing down the rabbit-hole that is Discourse dev, I came to something that I could use some clarification on if possible. I could be missing something extremely obvious, but here’s where I need some help:

If I print out `Object.keys(attrs)` in a `createWidget()`, I get a list like:

`id,username,avatar_template,post_count,primary_group_name,primary_group_flair_url,primary_group_flair_color,primary_group_flair_bg_color,topic`

I have a few questions:

1. **How are widget attributes established?** It seems like each `createWidget()` has its own set of attributes and I’m having trouble tracking down where they come from and how they are determined.

2. **How do I get an attribute that isn’t a part of a widget’s `attrs` by default?** For example, in the above list, how would I add `trust_level` to that attribute object?

3. **Can the addition of an attribute be done in the context of a theme component or would it require a proper plugin or modifying core Discourse?**

I can provide more details on the exact scenario that prompted these questions if that helps. I just wanted to keep it brief if I can.

Also worth mentioning, I’ve read the “Rendering Attributes” section of [A tour of how the Widget (Virtual DOM) code in Discourse works](https://meta.discourse.org/t/a-tour-of-how-the-widget-virtual-dom-code-in-discourse-works/40347) and still haven’t quite found the answers for my specific scenario.

---

_[View the full topic](https://meta.discourse.org/t/widget-attribute-clarifications/82870)._
