I am developing a custom module in Magento 2.0.9 and writing the system.xml file to allow users to make some settings from backend.

Now I need to show a Radio button in custom module backend settings section. This is what I wrote in system.xml

<field id="box_small_left_h_alignment" translate="label" type="radio" sortOrder="31" showInDefault="1" showInWebsite="1" showInStore="1">
    <label>Horizontal Alignment</label>

And this is the source model:


namespace SG\Slider\Model\Backend\Options;

class HorizontalAlignment implements \Magento\Framework\Option\ArrayInterface {

    public function toOptionArray()
        return [['value' => 'left', 'label' => __('Left')], ['value' => 'right', 'label' => __('Right')],];


Doing in this way no error are thrown in the backend but my radio field has no options. What am I missing?

  • Try to delete the last comma in this instruction: return [['value' => 'left', 'label' => __('Left')], ['value' => 'right', 'label' => __('Right')],];
    – WaPoNe
    Jan 3, 2017 at 11:29

1 Answer 1


You have to use radios instead of radio as field type.

  • 1
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
    – 7ochem
    Jan 3, 2017 at 13:33
  • 1
    I'm sorry but I don't understand you.. my answer provides a solution to the question. The issue is due to the use of radio instead of radios; I've also tested it and it works fine.
    – WaPoNe
    Jan 3, 2017 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.