Adding the web part
Once installed into your SharePoint Online tenant, you can easily add this web part at the top of your SharePoint modern page.
Headings and styles
Select your preferred heading type, enter in your chosen title and choose the preferred style that goes with your page design.
Customise your table of contents to scroll with the page, show back to top link, and enter your preferred back to top link text.
Always display mode
Different heading options
Toggle “Scroll navigation with page” On to enable the table of contents to always display on the side of your content.