On This Page
This is the first heading.
This is a sub-heading H3 example.
The ToC reacts to changes on the page and updates when headings change or get added or removed.
This one also gets added and removed.
H4 headings were added to the list of excluded heading tags, so this will not show up in the table of contents.
You can adjust the filter function to show or hide headings based on specific requirements. Check the code for an example.
Ato UI is built on top of Melt UI, an accessible headless library that follows WAI-ARIA design patterns and takes care of all the nitty-gritty details like aria attributes, role management, focus handling, and keyboard navigation. You can read more about it on the official Melt UI docs website, where each builder has a thorough description of implemented accessibility features.
Our styled components offer additional functionalities on top of Melt UI builders, while also staying flexible and offering ways to customize each component. This is done through our theme designer, which controls the color palette as well as things like border radiuses and text colors, and through style props that components offer, where you can overwrite default component styles.
On This Page
If you put the table of contents (ToC) in the layout file where the content for which the ToC should be created is updated with each page, you will have to wrap the table of contents in a #key
block.
<script lang="ts">
import { page } from '$app/stores';
import { TOC } from 'ato-ui';
</script>
{#key $page.url.pathname}
<TOC target="#content" />
{/key}