James’ way is good for smaller frames.
For larger frames, adhere the fabric (either loose fabric or fabric mat board) onto 1/8” foamboard. Cut the foamboard strips to the depth that you need for the shadowbox, leaving room for the glass and the substrate and backing of the item(s) you are enclosing.
Cut the length of these fabric/foamboard strips to the length of the rabbet (minus ~ 1/16”). Cut and “Dry Fit” each strip individually to its final resting place in the rabbet. Clean the glass, and place it in the frame. Then glue and place each foamboard/fabric strip against the rabbet. The 1/8" thickness of the foamboard will keep the glass in place. Place your substrate/backing on “top” of these strips. They will act as a spacer.
Fit the frame in the usual manner.
You are left with a seam in each corner, but because of the normal front viewing angle and the lack of light in the corners, they will hardly be noticed.
The only difficulty with this method is that if you ever need to replace the glass, you’ll need to remove (and, perhaps, destroy) these foamboard/fabric spacers.