webiny-js
webiny-js copied to clipboard
HCMS: Configure Dynamic Zone and Object field to be expanded by default
Is your feature request related to a problem? Please describe.
In our customer project, we see the requirement to always render a dynamic zone open with it's content. Right now, every time a DZ is rendered, it is collapsed and editors always have to spend an additional click to open it and see the inner content.
Describe the feature's behavior.
To improve editor UX, it would be best to configure a DZ or an object (accordion renderer) to always be expanded when rendered initially.
- The
AccordionItemreact component used in dynamicZoneRenderer.tsx does indeed support anopenproperty which I expect does open the accordion item by default - I'd say, there are only two things we need to do:
- Extend the CmsModelFieldSettings by an
open?: booleanattribute or use it's definition[key: string]: anyto support the newopenconfiguration. - Pass the value of the
openconfiguration to theopenproperty of theAccordionItemin the dynamic zone renderer and the object renderers (single & multiple). Something like:
- Extend the CmsModelFieldSettings by an
<AccordionItem
title={title}
description={description}
className={className || defaultClassName}
open={field.settings?.open || false}
>
{children}
</AccordionItem>
Describe alternatives you've considered.
No response
My considerations are based on the case that the content model is defined in-code.
Additional masseurs have to be taken in order to enable the open config for the no-code content model editor.