|
| 1 | +# FsNavFrameModule Documentation |
| 2 | + |
| 3 | +The `FsNavFrameModule` provides a flexible, modern navigation frame for Angular Material applications. It includes a responsive sidebar, toolbar, and user profile area, supporting content projection and theming. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- **Responsive sidebar navigation** with customizable items and icons |
| 10 | +- **Toolbar** with start, center, and end content slots |
| 11 | +- **User profile section** with name, subname, actions, and profile picture |
| 12 | +- **Configurable sizing** for toolbar and sidebar |
| 13 | +- **Content projection** for full layout flexibility |
| 14 | +- **Material 3 theming** support |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## Module Import |
| 19 | + |
| 20 | +```ts |
| 21 | +import { FsNavFrameModule } from '@fullstack-devops/ngx-mat-components'; |
| 22 | +``` |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Main Components & Directives |
| 27 | + |
| 28 | +- [`FsNavFrameComponent`](../projects/ngx-mat-components/src/fs-nav-frame/fs-nav-frame.component.ts) |
| 29 | +- [`FsNavFrameToolbarComponent`](../projects/ngx-mat-components/src/fs-nav-frame/nav-frame-toolbar/fs-nav-frame-toolbar.component.ts) |
| 30 | +- [`FsNavFrameSidebar`](../projects/ngx-mat-components/src/fs-nav-frame/components/fs-nav-frame-sidebar.ts) |
| 31 | +- [`FsNavFrameSidebarItemComponent`](../projects/ngx-mat-components/src/fs-nav-frame/components/fs-nav-frame-sidebar-item/fs-nav-frame-sidebar-item.component.ts) |
| 32 | +- [`FsNavUserProfileComponent`](../projects/ngx-mat-components/src/fs-nav-frame/fs-nav-user-profile/fs-nav-user-profile.component.ts) |
| 33 | +- [`FsNavFrameContentDirective`](../projects/ngx-mat-components/src/fs-nav-frame/directives/fs-nav-frame-content.directive.ts) |
| 34 | +- Toolbar slot directives: |
| 35 | + - [`FsNavFrameToolbarStartDirective`](../projects/ngx-mat-components/src/fs-nav-frame/nav-frame-toolbar/directives/fs-nav-frame-toolbar-start.directive.ts) |
| 36 | + - [`FsNavFrameToolbarCenterDirective`](../projects/ngx-mat-components/src/fs-nav-frame/nav-frame-toolbar/directives/fs-nav-frame-toolbar-center.directive.ts) |
| 37 | + - [`FsNavFrameToolbarEndDirective`](../projects/ngx-mat-components/src/fs-nav-frame/nav-frame-toolbar/directives/fs-nav-frame-toolbar-end.directive.ts) |
| 38 | +- User profile slot directives: |
| 39 | + - [`FsNavUserProfileNameDirective`](../projects/ngx-mat-components/src/fs-nav-frame/fs-nav-user-profile/directives/fs-nav-user-profile-name.directive.ts) |
| 40 | + - [`FsNavUserProfileSubNameDirective`](../projects/ngx-mat-components/src/fs-nav-frame/fs-nav-user-profile/directives/fs-nav-user-profile-subname.directive.ts) |
| 41 | + - [`FsNavUserProfileActionsDirective`](../projects/ngx-mat-components/src/fs-nav-frame/fs-nav-user-profile/directives/fs-nav-user-profile-actions.directive.ts) |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +## Usage Example |
| 46 | + |
| 47 | +```html |
| 48 | +<fs-nav-frame [navFrameConfig]="navFrameConfig" [sizing]="sizing"> |
| 49 | + <fs-nav-frame-toolbar> |
| 50 | + <fs-nav-frame-toolbar-start>App Title</fs-nav-frame-toolbar-start> |
| 51 | + <fs-nav-frame-toolbar-center> |
| 52 | + <!-- Centered toolbar content --> |
| 53 | + </fs-nav-frame-toolbar-center> |
| 54 | + <fs-nav-frame-toolbar-end> |
| 55 | + <!-- Toolbar actions, e.g. search, theme switcher --> |
| 56 | + </fs-nav-frame-toolbar-end> |
| 57 | + </fs-nav-frame-toolbar> |
| 58 | + |
| 59 | + <fs-nav-frame-sidebar> |
| 60 | + <fs-nav-frame-sidebar-item routerLink="/home"> |
| 61 | + <i-lucide [img]="HomeIcon"></i-lucide> |
| 62 | + <span>Home</span> |
| 63 | + </fs-nav-frame-sidebar-item> |
| 64 | + <!-- More sidebar items --> |
| 65 | + </fs-nav-frame-sidebar> |
| 66 | + |
| 67 | + <fs-nav-user-profile [profilePicture]="profilePicUrl"> |
| 68 | + <fs-nav-user-profile-name>Jane Doe</fs-nav-user-profile-name> |
| 69 | + <fs-nav-user-profile-subname>Engineer</fs-nav-user-profile-subname> |
| 70 | + <fs-nav-user-profile-actions> |
| 71 | + <button mat-icon-button>...</button> |
| 72 | + </fs-nav-user-profile-actions> |
| 73 | + </fs-nav-user-profile> |
| 74 | + |
| 75 | + <fs-nav-frame-content> |
| 76 | + <router-outlet></router-outlet> |
| 77 | + </fs-nav-frame-content> |
| 78 | +</fs-nav-frame> |
| 79 | +``` |
| 80 | + |
| 81 | +--- |
| 82 | + |
| 83 | +## Configuration |
| 84 | + |
| 85 | +### `navFrameConfig` ([`NavFrameConfig`](../projects/ngx-mat-components/src/fs-nav-frame/fs-nav-frame.modules.ts)) |
| 86 | + |
| 87 | +```ts |
| 88 | +export interface NavFrameConfig { |
| 89 | + appName?: string; // Displayed app name (opened mode) |
| 90 | + appVersion?: string; // Optional app version |
| 91 | + logoSrc?: string; // Optional logo URL |
| 92 | + sizing?: NavFrameSizing; // Optional sizing config |
| 93 | +} |
| 94 | +``` |
| 95 | + |
| 96 | +### `sizing` ([`NavFrameSizing`](../projects/ngx-mat-components/src/fs-nav-frame/fs-nav-frame.modules.ts)) |
| 97 | + |
| 98 | +```ts |
| 99 | +export interface NavFrameSizing { |
| 100 | + toolbarHeight?: number; // Toolbar height in rem (default: 3) |
| 101 | + sidebarWidthClosed?: number; // Sidebar width (closed) in rem (default: 4) |
| 102 | + sidebarWidthOpened?: number; // Sidebar width (opened) in rem (default: 18) |
| 103 | +} |
| 104 | +``` |
| 105 | + |
| 106 | +--- |
| 107 | + |
| 108 | +## Sidebar Navigation |
| 109 | + |
| 110 | +- Use `<fs-nav-frame-sidebar>` to define the sidebar. |
| 111 | +- Add `<fs-nav-frame-sidebar-item>` for each navigation entry. |
| 112 | +- Use `[routerLink]` for Angular routing. |
| 113 | +- You can project icons and labels. |
| 114 | + |
| 115 | +--- |
| 116 | + |
| 117 | +## Toolbar |
| 118 | + |
| 119 | +- Use `<fs-nav-frame-toolbar>` to define the toolbar. |
| 120 | +- Slot content using `<fs-nav-frame-toolbar-start>`, `<fs-nav-frame-toolbar-center>`, and `<fs-nav-frame-toolbar-end>` for flexible layouts. |
| 121 | + |
| 122 | +--- |
| 123 | + |
| 124 | +## User Profile |
| 125 | + |
| 126 | +- Use `<fs-nav-user-profile>` for the user section. |
| 127 | +- Project name, subname, and actions using: |
| 128 | + - `<fs-nav-user-profile-name>` |
| 129 | + - `<fs-nav-user-profile-subname>` |
| 130 | + - `<fs-nav-user-profile-actions>` |
| 131 | + |
| 132 | +--- |
| 133 | + |
| 134 | +## Theming & Styling |
| 135 | + |
| 136 | +- The module supports Material 3 theming. |
| 137 | +- SCSS mixin: `fs-nav-frame-theme` ([styles/fs-nav-frame/_theming.scss](../projects/ngx-mat-components/styles/fs-nav-frame/_theming.scss)) |
| 138 | +- To use the theme in your styles: |
| 139 | + ```scss |
| 140 | + @use '@fullstack-devops/ngx-mat-components' as fsc; |
| 141 | + |
| 142 | + @include mat.app-background(); |
| 143 | + |
| 144 | + @include fsc.core(); |
| 145 | + ``` |
| 146 | + |
| 147 | +--- |
| 148 | + |
| 149 | +## API Reference |
| 150 | + |
| 151 | +- [`FsNavFrameComponent`](../projects/ngx-mat-components/src/fs-nav-frame/fs-nav-frame.component.ts) |
| 152 | +- [`FsNavFrameModule`](../projects/ngx-mat-components/src/fs-nav-frame/fs-nav-frame.module.ts) |
| 153 | +- [`NavFrameConfig`](../projects/ngx-mat-components/src/fs-nav-frame/fs-nav-frame.modules.ts) |
| 154 | +- [`NavFrameSizing`](../projects/ngx-mat-components/src/fs-nav-frame/fs-nav-frame.modules.ts) |
| 155 | + |
| 156 | +--- |
| 157 | + |
| 158 | +## Example Screenshot |
| 159 | + |
| 160 | + |
| 161 | + |
| 162 | +--- |
| 163 | + |
| 164 | +## See Also |
| 165 | + |
| 166 | +- [Live Demo](https://fullstack-devops.github.io/ngx-mat-components) |
| 167 | +- Workspace Example: |
| 168 | + - [app.html](https://github.com/fullstack-devops/ngx-mat-components/blob/main/projects/lib-workspace/src/app/app.html) |
| 169 | + - [app.ts](https://github.com/fullstack-devops/ngx-mat-components/blob/main/projects/lib-workspace/src/app/app.ts) |
0 commit comments