Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

    Function prepareSelectOptionGroups

    • Structure a provided array of select options into a standardized format for rendering optgroup and option elements.

      Returns { group: string; options: FormSelectOption[] }[]

      const options = [
      {value: "bar", label: "Bar", selected: true, group: "Good Options"},
      {value: "foo", label: "Foo", disabled: true, group: "Bad Options"},
      {value: "baz", label: "Baz", group: "Good Options"}
      ];
      const groups = ["Good Options", "Bad Options", "Unused Options"];
      const optgroups = foundry.applications.fields.prepareSelectOptionGroups({options, groups, blank: true, sort: true});