skip section navigation

Navbar, NavTab and NavbarLogo

Navbar positions the main app destinations at a viewport edge. NavTab supplies each destination link, and NavbarLogo supplies an optional brand image. keep Navbar beside Loaf inside Basket so the shell reserves its space.

usage

svelte
<script>
	import { Navbar, NavTab } from '@ciabi/loafkit-ui';
</script>

<Navbar test position="bottom">
	<NavTab href="/docs/introduction/" label="Start" active />
	<NavTab href="/docs/foundations/choose-a-component/" label="Components" />
</Navbar>

composition

  • Navbar
    • home link(optional)
      • NavbarLogo
    • NavTab (one per destination)

destination semantics

NavTab navigates with links; it doesn’t supply arrow-key tab selection or tab panels.

preview responsive navigation and active destinations

svelte
<script lang="ts">
import { Navbar, NavTab, Selector } from '@ciabi/loafkit-ui';
let navPlacement = $state<'bottom' | 'left' | 'left-bottom'>('left-bottom');
let navDestination = $state('reading');
</script>

<Selector label="navigation placement" selected={navPlacement} onValueChange={value => navPlacement = value as typeof navPlacement}
	options={[{value:'bottom',label:'bottom'},{value:'left',label:'left side'},{value:'left-bottom',label:'side on desktop, bottom on mobile'}]} />
<Selector label="active destination preview" bind:selected={navDestination}
	options={[{value:'reading',label:'reading'},{value:'settings',label:'settings'}]} />
<div style="height: 18rem; overflow: auto;">
	<Navbar test position={navPlacement}>
		<NavTab href="/docs/introduction/" label="reading" active={navDestination === 'reading'} />
		<NavTab href="/docs/foundations/flavors/" label="settings" active={navDestination === 'settings'} />
	</Navbar>
</div>
svelte
<script lang="ts">
	import { Navbar, NavbarLogo, NavTab } from '@ciabi/loafkit-ui';
	import brandImage from '$lib/assets/emotions/strawhat.png';
</script>

<Navbar test>
	<a href="/" aria-label="reading room home"><NavbarLogo src={brandImage} alt="" /></a>
	<NavTab href="/docs/introduction/" label="library" active layout="horizontal" />
</Navbar>

API reference

Component
test
Default: false

keeps the navigation in document flow for an embedded preview.

class
Default: ''

extra classes on the component root.

style

inline styles on the component root.

position
Default: 'bottom'

the viewport-edge placement and its responsive treatment.

children

destination links and optional app branding.

Component
Icon

a Svelte icon component.

href

the destination URL.

label

the visible control name.

layout

the destination’s icon/text arrangement.

iconColor

the destination icon color.

active
Default: false

marks this destination as current; your router supplies the state.

class
Default: ''

extra classes on the component root.

style

inline styles on the component root.

target

native browsing target for the link.

rel

native relationship tokens for the link.

Component
src

app-owned brand image.

alt
Default: 'logo'

alternative text; use empty text inside an already named home link.