Skip to content

How To Create Toggle Yes/No Category Attribute?

I want to create Yes/No flag attribute in category admin panel.

Data patch is already created and in category_form.xml i am trying different solutions.

<fieldset name="general">
        <field name="enable_slider">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="required" xsi:type="boolean">false</item>
                    <item name="validation" xsi:type="array">
                        <item name="required-entry" xsi:type="boolean">false</item>
                    </item>
                    <item name="sortOrder" xsi:type="number">333</item>
                    <item name="dataType" xsi:type="string">string</item>
                    <item name="formElement" xsi:type="string">input</item>
                    <item name="label" xsi:type="string" translate="true">Enable Slider</item>
                </item>
            </argument>
        </field>
</fieldset>```