Skip to content

A widget for Netlify CMS that will conditionally show a second select with its own options based on what's chosen in the first select. This can be used, for example, to set up subcategories inside of categories.

License

Notifications You must be signed in to change notification settings

kbravh/netlify-cms-widget-nested-select

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

netlify-cms-widget-nested-select

Check out a demo!

This widget will conditionally show a second select with its own options based on what's chosen in the first select. This can be used, for example, to set up subcategories inside of categories.

Install

As an npm package:

npm install --save netlify-cms-widget-nested-select
import {NestedSelectControl, NestedSelectPreview} from 'netlify-cms-widget-nested-select'

CMS.registerWidget('nested-select', NestedSelectControl, NestedSelectPreview)

Via script tag:

<script src="https://unpkg.com/netlify-cms-widget-nested-select@^1.0.0"></script>

<script>
  CMS.registerWidget('nested-select', NestedSelectControl, NestedSelectPreview)
</script>

How to use

Add to your Netlify CMS configuration:

    fields:
      - {
          name: <fieldname>,
          label: <fieldlabel>,
          widget: nested-select,
          options: [
            "Regular option",
            "Another regular option",
            {
              label: "Option with suboptions",
              options: [
                "Suboption 1",
                "Suboption 2",
                "Suboption 3"
              ]
            }
          ]
        }

Support

For help with this widget, open an issue.

About

A widget for Netlify CMS that will conditionally show a second select with its own options based on what's chosen in the first select. This can be used, for example, to set up subcategories inside of categories.

Topics

Resources

License

Stars

Watchers

Forks