Living documentation for maintaining UI consistency across all pages
This style guide defines the design system for the Tanach project. All user-facing pages MUST follow these guidelines to ensure a consistent user experience.
Key Principles:
tanach-common.css
Design tokens are defined in src/css/tanach-common.css. All pages MUST use these tokens instead of hardcoded values.
All user-facing pages MUST include the theme toggle component using the Web Component.
The theme toggle appears in the lower left corner (see bottom of page).
<!-- In the <body> tag -->
<script type="module" src="src/js/components/ThemeToggle.js"></script>
<theme-toggle></theme-toggle>
<!-- For subdirectories, add path-prefix attribute -->
<theme-toggle path-prefix="../"></theme-toggle>
<!-- Theme Toggle -->
<div id="theme-toggle" class="btn-group position-fixed"
style="bottom: 20px; left: 20px; z-index: 1000; box-shadow: 0 2px 10px rgba(0,0,0,0.2);">
<button class="btn btn-outline-secondary" data-theme="light" title="Light Theme">
<i class="bi bi-sun-fill"></i>
</button>
<button class="btn btn-outline-secondary" data-theme="dark" title="Dark Theme">
<i class="bi bi-moon-fill"></i>
</button>
<button class="btn btn-outline-secondary" data-theme="system" title="System Theme">
<i class="bi bi-display"></i>
</button>
</div>
<!-- Theme Manager Script -->
<script src="src/js/ThemeManager.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
ThemeManager.initialize();
});
</script>
bottom: 20px, left: 20pxbtn-outline-secondary class (NOT btn-secondary)bi-sun-fill for light themebi-moon-fill for dark themebi-display for system themez-index: 10000 2px 10px rgba(0,0,0,0.2)bi-moon-stars-fill, bi-circle-half)The page header component provides consistent headers across pages.
<script type="module" src="src/js/components/PageHeader.js"></script>
<page-header title="התנ"ך - Hebrew Bible" subtitle="Optional subtitle"></page-header>
Web Components provide reusable, consistent UI elements.
| Component | File | Usage | Status |
|---|---|---|---|
<theme-toggle> |
src/js/components/ThemeToggle.js |
Theme switching buttons | MANDATORY |
<page-header> |
src/js/components/PageHeader.js |
Page title and subtitle | OPTIONAL |
Typography tokens ensure consistent font sizing and hierarchy.
--font-size-xs: 0.75rem (12px)--font-size-sm: 0.875rem (14px)--font-size-base: 1rem (16px)--font-size-lg: 1.125rem (18px)--font-size-xl: 1.25rem (20px)--font-size-2xl: 1.5rem (24px)--font-size-3xl: 1.75rem (28px)--font-size-4xl: 2rem (32px)--font-size-5xl: 2.5rem (40px)Color tokens automatically adapt to light and dark themes.
Use spacing tokens for consistent margins and padding.
/* Use spacing tokens instead of hardcoded values */
.my-element {
margin: var(--spacing-lg); /* Good ✅ */
margin: 20px; /* Bad ❌ */
padding: var(--spacing-md); /* Good ✅ */
padding: 12px; /* Bad ❌ */
}
tanach-common.cssleft: 20px; bottom: 20px;tanach-common.css for colors, spacing, typographyStandard Layout Pattern:
top: 20px; left: 20px;1001 (above theme toggle)pasuk.html, Book selector in BasicTropsMulti.htmlbottom: 20px; left: 20px;1000Rationale: Separating settings (top) from theme controls (bottom) creates clear visual hierarchy and prevents button overlap.