skip section navigation

design tokens

Loafkit’s tokens are CSS variables. use the semantic name for the role you’re styling, so a flavor can change the palette without making text unreadable or leaving one panel on the old background.

palette pairs

tokenbase value or role
--loaf-surface#ffffff, primary surface
--loaf-surface-secondary#eaeef5, secondary surface
--loaf-text#282828, foreground
--loaf-accent#4273fa, primary emphasis
--loaf-accent-secondary#455fa8, secondary emphasis
--loaf-success#40d672
--loaf-warning#ffd63a
--loaf-error#f7374f
--loaf-text-mutedderived from text
--loaf-nav-bg, --loaf-nav-hover-bgnavigation backgrounds
--loaf-nav-highlight, --loaf-nav-active-highlightnavigation emphasis

these are stylesheet defaults, not a promise that a named flavor uses those colors. set foreground and background together when overriding a surface.

scope an override

Paper preview

This section owns its palette.

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

<section style="--loaf-surface: #FFFDF7; --loaf-surface-secondary: #EEE9DD; --loaf-text: #292720; --loaf-accent: #566B3A; --loaf-text-on-accent: #FFFFFF; --loaf-card-background: var(--loaf-surface); color: var(--loaf-text)">
	<Card title="Paper preview">
		<p>This section owns its palette.</p>
		<button type="button" class="loaf-primary">Keep reading</button>
	</Card>
</section>

the variables stay inside the section. set the Card background hook locally too, so it resolves against this section rather than inheriting a value computed at the root. registering a global flavor is a separate task; see flavors.

spacing, shape and depth

familydefaults
--loaf-spacing-xs, -sm, -md, -lg3px, 6px, 12px, 24px
--loaf-radius-xs, -sm, -md, -lg4px, 8px, 12px, 24px
--loaf-radius-pill, --loaf-radius-circle100px, 50%
--loaf-shadow-sm, -md, -lgshared elevation shadows
--loaf-border-colorsubtle border derived from text
--loaf-focus-ringaccent by default
--loaf-text-font, --loaf-code-fontsystem stacks until font setup overrides them

each abbreviated family entry means the full shared prefix, such as --loaf-spacing-md. component hooks include --loaf-card-background, --loaf-card-stroke, --loaf-card-box-shadow, --loaf-button-default-background, --loaf-button-box-shadow, --loaf-popover-bg and --loaf-popup-padding.

light and dark selectors use data-flavor-type to adjust shadows, toggle backgrounds and hover filters. status foreground overrides include --loaf-text-on-accent, --loaf-text-on-success, --loaf-text-on-warning and --loaf-text-on-error. they’re optional overrides, not preset contrast guarantees. check the real pairs, including nested surfaces and focus states.