@zellvora/ng-layout
v0.1.1
Published
Enterprise Angular 21 layout components - fully Signal-based, SSR-compatible, zoneless, tree-shakable.
Readme
@zellvora/ng-layout
Enterprise Angular 21 layout components library - fully Signal-based, SSR-compatible, zoneless, and tree-shakable.
Features
- 100% Signal-based - Uses Angular Signals throughout, computed(), effect(), input(), output()
- No Dependencies - Zero Angular Material dependency, built from scratch
- Standalone Components - All components are standalone, no NgModules
- SSR Compatible - Works seamlessly with Angular Universal and Server-Side Rendering
- Zoneless Ready - Compatible with Angular's zoneless change detection
- Tree Shakable - Every file is optimized for dead code elimination
- Type Safe - Full TypeScript support with comprehensive types
- Themeable - CSS Custom Properties for dynamic theming
- Accessible - WCAG AA compliant with ARIA support
Installation
npm install @zellvora/ng-layoutComponents
Foundation
zv-container- Width-constrained containerzv-section- Semantic section wrapperzv-page- Full-height page containerzv-main- Main content areazv-content- Scrollable content areazv-aside- Sidebar/aside areazv-spacer- Flexible spacerzv-divider- Separator linezv-header- Page header with sticky supportzv-footer- Page footerzv-toolbar- Action toolbar
Grid System
zv-grid- CSS Grid container (12/24 columns)zv-row- Flexbox row containerzv-column- Grid cell with responsive span
Stack & Layout
zv-stack- Vertical/horizontal stack with gapzv-wrap- Flexbox wrap container
Services
BreakpointService- Responsive breakpoint detectionThemeService- Theme switching and CSS variable managementViewportService- Viewport dimensions and scroll trackingSidebarService- Sidebar state managementDrawerService- Multi-drawer state managementLayoutService- Orchestrates layout componentsScrollService- Scroll utilitiesNavigationService- Navigation state and menu management
Hooks
Injection functions for accessing services:
import { useBreakpoint, useTheme, useSidebar } from '@zellvora/ng-layout';
export class MyComponent {
breakpoint = useBreakpoint();
theme = useTheme();
sidebar = useSidebar();
}Basic Usage
import {
ZvPage,
ZvHeader,
ZvMain,
ZvFooter,
ZvContainer,
ZvStack,
} from '@zellvora/ng-layout';
@Component({
selector: 'app-root',
standalone: true,
imports: [ZvPage, ZvHeader, ZvMain, ZvFooter, ZvContainer, ZvStack],
template: `
<zv-page>
<zv-header sticky>
<h1>My App</h1>
</zv-header>
<zv-main>
<zv-container size="lg" padding="md">
<zv-stack direction="vertical" gap="lg">
<h2>Welcome</h2>
<p>Your content here</p>
</zv-stack>
</zv-container>
</zv-main>
<zv-footer>
<p>© 2024</p>
</zv-footer>
</zv-page>
`,
})
export class AppComponent {}Responsive Breakpoints
| Breakpoint | Min Width | |-----------|-----------| | xxs | 0px | | xs | 320px | | sm | 640px | | md | 768px | | lg | 1024px | | xl | 1280px | | xxl | 1536px |
Theming
All components use CSS Custom Properties for theming. Set custom values on :root:
:root {
--zv-layout-primary: #3b82f6;
--zv-layout-secondary: #6b7280;
--zv-layout-surface: #ffffff;
--zv-layout-border: #e5e7eb;
/* ... more variables */
}License
MIT
