Page Content Navigation
How can I implement the navigation menu of the NuxtUI wepage (https://nuxt.com)
For example, which component can I use to implement the "On this page" pop-out menu?

6 Replies
Hi @Alex. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To implement the "On this page" pop-out menu (Table of Contents) like on the NuxtUI or Nuxt.com documentation pages, you should use the
- The
UContentToc
component from Nuxt UI Pro. This component provides a sticky Table of Contents with automatic active anchor link highlighting and is designed to work with the @nuxt/content
module.
Basic usage example:
You can customize the title, color, and highlight of the Table of Contents using the title
, color
, and highlight
props:
Note:- The
UContentToc
component is only available when the @nuxt/content
module is installed.
- The links
prop should be populated with the TOC links generated from your page content, typically available at page.body.toc.links
when using Nuxt Content.
For more details and advanced usage, see the UContentToc documentation and example layouts that use it in the right slot of the UPage
component here source.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@822057189556486186> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@kapa.ai How do I generate TOC links from my page?
it's auto generated when you have a nuxt content page that's how i set mine up. all my H1 tags automatically became available in the toc links
not sure if it works or not without using nuxt content haven't tried it
You can enable all content components using
You can view the docs for how to format your links: https://github.com/nuxt/ui-pro/blob/v3/src/runtime/components/content/ContentToc.vue
But you will also have to tag your heading tags with ids.
thank you, I think I will use the UContentToc without auto generated TOC for now, this should be possible by just passing another data into the component.