skip section navigation

give the app a shell

Basket holds the viewport. Loaf provides the content scroller. Navbar sits beside Loaf and reserves space for itself, so keep them as siblings inside Basket.

after installing the package, use this as your root component. the links are example routes; create those pages or point them at your app’s destinations:

svelte
<script>
	import '@ciabi/loafkit-ui/app.css';
	import { Basket, Loaf, Navbar, NavTab, PageContainer } from '@ciabi/loafkit-ui';
</script>

<Basket>
	<Loaf>
		<PageContainer pageId="reading" maxWidth="60rem">
			<h1>Reading list</h1>
			<p>Make room for the things you want to come back to.</p>
		</PageContainer>
	</Loaf>
	<Navbar position="bottom">
		<NavTab href="/" label="Reading" active />
		<NavTab href="/settings/" label="Settings" />
	</Navbar>
</Basket>

PageContainer renders main and adds centered width, padding and vertical spacing. Basket and Loaf use fixed IDs, so render one of each for this shell. a reusable panel inside a page can use a normal section or div instead.

you should see the reading page with navigation along the bottom. content scrolls above the navbar instead of disappearing behind it. you can change position later without adding a second layout wrapper.

choose the scrolling element

Loaf owns #loaf, which scrolls inside the shell. code that measures reading progress needs that element rather than assuming the browser document scrolls. see OnThisPage for an explicit scrollContainer example.

keep page layout local

use flex or grid to arrange components within the page. shared styles own native buttons and links; components own their internal padding. your layout only needs to add the gaps, wrapping and widths between those pieces.

the shell responds to Navbar position and narrow screens. test the position you choose with your real labels and mobile safe areas. don’t add another fixed bottom spacer before checking the space Navbar already reserves.

fonts and reading text

fonts.css requests Bricolage Grotesque and Fira Mono from Google Fonts. without it, the base tokens use system font stacks. .loaf-paragraph-text applies the library’s reading styles to ordinary article content. see typography and utilities for a smaller, shell-free example.