decap-cms icon indicating copy to clipboard operation
decap-cms copied to clipboard

List widget with variable types should allow hints or descriptions for each type

Open boygirl opened this issue 5 years ago • 2 comments

I'm making extensive use of variable types in the list widget, and it has been extremely useful! One thing I would like to see would be the ability to add a hint or description for the whole type. My current work around is adding a dummy boolean widget and giving it a hint, but that feels kind of hacky. The ideal solution would be to support a hint or description for the entire type that would show at the top of the control for each type.

For example:

label: 'Home Section'
  name: 'sections'
  widget: 'list'
  types:
    - label: 'Carousel'
      name: 'carousel'
      widget: object
      hint: 'this is a description of the carousel type. This description should render above any fields for this type",
      fields:
        - { label: Header, name: header, widget: string, default: 'Image Gallery' }
        ...

Another possibly easier change would be to allow hidden fields to display hints if they have any.

boygirl avatar Apr 22 '20 17:04 boygirl

Any hints (pun intended) where to start if I want to take this and contribute to the project? Thanks!

marovargovcik avatar Sep 29 '21 11:09 marovargovcik

Hi @marovargovcik! The hint configuration is accessed here: https://github.com/netlify/netlify-cms/blob/089533683b0483d31da6dc158f3b9bb5f14fb88f/packages/netlify-cms-core/src/components/Editor/EditorControlPane/EditorControl.js#L215

and the List widget is rendered here: https://github.com/netlify/netlify-cms/blob/089533683b0483d31da6dc158f3b9bb5f14fb88f/packages/netlify-cms-widget-list/src/ListControl.js#L500

erezrokah avatar Sep 29 '21 18:09 erezrokah