Radio Buttons inside Custom theme components

Hi,
I have installed discourse on my local and now I am trying to make a custom theme component with emberjs. Inside my hbs file there are radio buttons. Can someone please tell me how we can add RadioButtons with default checked values. I spend days around this component and now got stuck with RadioButtons. Any help will be appreciated.

After looking at the discouse source code I did something like this

<span class="yes">
    <RadioButton
      @class="radio"
      @name="product_news"
      @value="true"
      @id="product_news_t"
      @checked={{this.user_preferences.spiceworks_newsletter}}
    />
    <label for="product_news_t">Yes</label>
</span>
<span class="no">
    <RadioButton
      @class="radio"
      @name="product_news"
      @value="false"
      @id="product_news_f"
      @checked={{this.user_preferences.spiceworks_newsletter}}
    />
  <label for="product_news_t">No</label>
</span>
1 Like

For <RadionButton> you should use the @selection parameter which will automagically set the checked property.

3 Likes