For displaying fields based on a checkbox status, please refer to:
https://www.youtube.com/watch?v=gcNa0uqxytg&ab_channel=AEMandDevopsTutorial
For displaying dialog fields based on the config in design dialog, please refer to WCM core Image component. I has a field decorative, which is dependent on value in policy (cqDesign.isDecorative)
"decorative": {
"jcr:primaryType": "nt:unstructured",
"uncheckedValue": "false",
"name": "./isDecorative",
"text": "Don’t provide an alternative text",
"value": true,
"checked": "${not empty cqDesign.isDecorative ? cqDesign.isDecorative : false}",
"sling:resourceType": "granite/ui/components/coral/foundation/form/checkbox",
"fieldDescription": "If the image is mostly decorative and doesn't convey additional meaning to a visitor, then it might be acceptable to not provide an alternative text, which will make the image ignored by assistive technology like screen readers."
},
Aanchal Sikka