# Showing simple text with decorateWidget

**URL:** https://meta.discourse.org/t/showing-simple-text-with-decoratewidget/62521
**Category:** Development
**Created:** [May 11, 2017, 2:59pm UTC](https://meta.discourse.org/t/showing-simple-text-with-decoratewidget/62521 "2017-05-11T14:59:52Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Radulf](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@Radulf](https://meta.discourse.org/u/Radulf)
#### Post date: [May 11, 2017, 2:59pm UTC](https://meta.discourse.org/t/showing-simple-text-with-decoratewidget/62521/1 "2017-05-11T14:59:52Z")

</div>

Hi

I started developing plugins for Discourse this week. I already finished my first one, that adds a button below each post that links to a homepage, depending on the post. Now, I’m on to my second project and I merely want to show some text after the name of the poster. It seems like decorateWidget is a nice way to go there, but I don’t know how I get that to work. By basic copy + pasting, I was able to show a small icon, but simply showing text still eludes me. Here’s my current code of the initializer:

```
import { withPluginApi } from 'discourse/lib/plugin-api'

function initializePlugin(api) {
  console.log(api)

  api.decorateWidget('poster-name:after', function(helper) {
    return helper.h('i.fa.fa-arrow-circle-up.home-button-icon');         
  });

}

export default {
  name: 'youtrack-button',
  initialize: function() {
    withPluginApi('0.1', api => initializePlugin(api))
  }
}

```

Especially the decorateWidget part is merely copy + paste that I simplified a bit. Unfortunately I did not find any documentation for decorateWidget or h, which would probably solve these basic questions. So, how would I need to change the code to show the content of some string behind the name?

Thanks for your help!

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [May 11, 2017, 3:02pm UTC](https://meta.discourse.org/t/showing-simple-text-with-decoratewidget/62521/2 "2017-05-11T15:02:36Z")

</div>

Please see [Markdown Reference](http://commonmark.org/help) for tips and a tutorial on making a code block.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [May 11, 2017, 5:26pm UTC](https://meta.discourse.org/t/showing-simple-text-with-decoratewidget/62521/3 "2017-05-11T17:26:28Z")

</div>

You should be able to just return the string. `h` is a html helper.

```plaintext
  api.decorateWidget('poster-name:after', function(helper) {
    return 'a string';
  });

```

---

<div class="post-metadata">

### Author: ![Radulf](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@Radulf](https://meta.discourse.org/u/Radulf)
#### Post date: [May 12, 2017, 11:43am UTC](https://meta.discourse.org/t/showing-simple-text-with-decoratewidget/62521/4 "2017-05-12T11:43:03Z")

</div>

That works great! Thanks!

Can I mark an answer as “Solved” somehow? I saw it in discourse already, but the button that is described in the according plugin is not visible to me ☹

---

<div class="post-metadata">

### Author: ![vinothkannans](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vinothkannans/32/86465_2.png) [@vinothkannans](https://meta.discourse.org/u/vinothkannans)
#### Post date: [May 12, 2017, 11:52am UTC](https://meta.discourse.org/t/showing-simple-text-with-decoratewidget/62521/5 "2017-05-12T11:52:23Z")

</div>

“Solved” button available only for #Support category in meta.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [May 12, 2017, 3:52pm UTC](https://meta.discourse.org/t/showing-simple-text-with-decoratewidget/62521/6 "2017-05-12T15:52:32Z")

</div>


