devdocs says default value is false but there is no clue how to turn it to true. Anyone know what to add in xml file to make it happen. Many thanks


You can use the following code to set the default checkbox value in ui_component

    <field name="myCheckbox" formElement="checkbox">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="default" xsi:type="boolean">true</item>
            <label translate="true">Enabled</label>
                <description translate="true">This is my checkbox's description</description>
                        <map name="false" xsi:type="boolean">false</map>
                        <map name="true" xsi:type="boolean">true</map>

Let me know if you have any other issue with the code Thanks

  • I've tried <item name="default" xsi:type="number">true</item> but it doesn't get it checked. – Long Nguyen May 5 '20 at 10:29
  • <item name="default" xsi:type="boolean">true</item> works. Edit your answer and I'll accept it. – Long Nguyen May 5 '20 at 10:31
  • @LongNguyen... Yes, you are right and I've updated my answer Thanks – Shankar May 6 '20 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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