skip section navigation

SubNav

SubNav is in-flow navigation for a section of your app. it accepts nested links and native disclosure groups, so you can keep a documentation tree or account settings together without another fixed navbar.

usage

svelte
<script>
	import { SubNav } from '@ciabi/loafkit-ui';
	const items = [
		{ label: 'Get started', href: '/docs/introduction/' },
		{ label: 'Customize', href: '/docs/foundations/flavors/', collapsible: true, children: [
			{ label: 'Flavors', href: '/docs/foundations/flavors/' },
			{ label: 'Artwork', href: '/docs/foundations/app-artwork/' }
		] }
	];
</script>

<SubNav {items} currentPath="/docs/foundations/flavors/" label="Reading room guides" />

labels are keyed within each list, so keep sibling labels unique.

currentPath controls aria-current="page". matching ignores one trailing slash; it doesn’t parse search parameters or determine your app’s route automatically. pass the current pathname rather than a complete URL.

API reference

Component
items

recursive destination and disclosure definitions.

currentPath
Default: ''

pathname used to mark the current destination.

label
Default: 'Section navigation'

the navigation landmark’s accessible name.

class
Default: ''

extra classes on the component root.

style

inline styles on the component root.

Type

one item supplied to SubNav.

label

destination/group label; keep sibling labels unique.

href

destination URL; adds Overview inside a collapsible group.

children

nested destinations or groups.

collapsible

uses native details/summary for children.

open

initial disclosure state; otherwise current descendants open the group.