The example below shows the LayerList component embedded within an Expand component, like the Basemap Gallery example earlier. One attribute you might consider setting is visibility-appearance, which allows for showing the user checkboxes for toggling layer visibility rather than the default eyeball icon.
See the Pen LayerList_component by Jim Detwiler (@jimdetwiler) on CodePen.