ArcGIS Online currently does not support publishing group layers as hosted feature services in a web map. According to the Esri Community, that functionality is “In the Product Plan.” Without a concrete timeframe (User Conference in July? End of the year?) on when the functionality will be available, here is an alternate method to organize content in a web app: Use Multiple Layer Lists to group content in a Web App created in Web AppBuilder.
Create Web App
Start out with your web map, which has your layers in the table of contents. In the Share menu, click Create A New Web App, and choose the Web AppBuilder tab.
Organize Layers in Layer Lists
Choose a Theme, then click on the Widget tab. Click “Set the Widgets in this Controller.” Click the + to add a widget, and choose Layer List. The idea is to add a Layer List widget for each theoretical group of feature layers, such as Land Use, Basemap Layers, Stormwater, etc. See image below for instructions.
NOTE: The steps in this blog reference the Foldable Theme in Web AppBuilder, with the Header Controller ribbon at the top of the app. Some themes may have a slightly different look with the Header Controller, or not use a Header Controller.
Once you have organized your layers, you can take it a step further and group your Layer List widgets. For example, if you have Layer Lists for Sanitary, Stormwater, Water Distribution, and Streetlights, you can group those Lists into a Widget Group called “Underground Infrastructure.”
To group widgets together, click and drag a widget on top of another to create a group. Rename the group as necessary.
Some Notes About Group Layer Lists
Keep in mind that any new layers added to your web map after creating the web app will be automatically added to ALL Layer Lists that you have created. Make adjustments to the Layer List groups as necessary.
In the Header Controller configuration, you can choose to either view the Widget Groups in a panel, or in a drop-down menu (see below).