1
0
Fork 0
freesewing/markdown/dev/reference/api/config/optiongroups/en.md
Joost De Cock 249f2600e5 chore: More linting
@nicholasdower is smarter than me. What's missing was the
`listItemIndent` setting
2022-02-20 14:44:38 +01:00

1.4 KiB

title
optionGroups

Option groups allow you to group options together when presenting them to the user. They also support (one) level of sub-grouping which is useful when your design has many options.

This section applies to frontend integration

When you use FreeSewing patterns via the API -- in a backend NodeJS system or on the command line for example -- all options can be used.

The conditional display of options is intended for frontend integration. It is what's used on FreeSewing.org and our development environment alike, but it is not intended as a way to block access to a given option. It merely hides it.

Structure

Option groups are stored under the optionGroups key in the pattern configuration file.

They hold a plain object where each property can hold:

  • An array of strings that are the names of the options to include in the group
  • A plain object whose properties hold an array of strings that are the names of the options to include in the group. (this creates a subgroup)

Example

optionGroups: {
  fit: [
    'chestEase',
    'waistEase',
  ],
  style: [
    'cuffStyle',
    'hemStyle',
    {
      collar: [
        'collarHeight',
        'collarShape'
      ]
    }
  ],
}

The configuration above will create the following structure:

  • fit
    • chestEase
    • waistEase
  • style
    • cuffStyle
    • hemStyle
    • collar
      • collarHeight
      • collarShape