Angular Utility Library | ng-hub-ui-utils
Angular utility library with pipes, focus management, overlays, transitions and translation helpers shared across reusable UI components.
API reference
Here's the full contract for utils: everything you can bind, listen to, project and theme, gathered in one place. Wire up what you need and style what you want — it's standalone and signal-friendly.
Inputs
Dial utils in with 4 inputs. Bind them like any Angular @Input.
| Name | Type | Default | Description |
|---|---|---|---|
HubTranslationService | Service | - | Injectable service for managing translations. Methods: getTranslation(), setTranslations() |
HubOverlayService | Service | - | Service for creating and managing overlays programmatically |
HubPopupService | Service | - | Simplified service for creating popup elements |
TooltipDirective | Directive | - | Directive ([tooltip]) that shows a positioned, themeable tooltip on hover/focus. Inputs: tooltip (text), placement, delay, offset. |
Outputs
React to what utils does — 7 events to hook your logic onto.
| Name | Type | Description |
|---|---|---|
TranslatePipe | Pipe | Translates a key using HubTranslationService. Usage: {{ "key" | translate }} |
GetPipe | Pipe | Gets nested property value. Usage: {{ object | get:"path.to.property" }} |
IsStringPipe | Pipe | Checks if value is a string. Usage: {{ value | isString }} |
IsObjectPipe | Pipe | Checks if value is an object. Usage: {{ value | isObject }} |
IsObservablePipe | Pipe | Checks if value is an Observable. Usage: {{ value | isObservable }} |
UcfirstPipe | Pipe | Capitalizes first letter. Usage: {{ "hello" | ucfirst }} → "Hello" |
UnwrapAsyncPipe | Pipe | Unwraps Observable or Promise values in templates |
Templates
Make it yours — 4 template slots let you project custom markup.
| Name | Description | Example |
|---|---|---|
hubFocusTrap() | Traps keyboard focus within an element. Useful for modals and dialogs. | hubFocusTrap(zone, element, stopFocusTrap$, refocusOnClick) |
interpolateString() | Replaces {{ placeholders }} with values from an object | interpolateString("Hello {{name}}", { name: "World" }) → "Hello World" |
getValue() | Gets nested property using dot notation | getValue(obj, "user.profile.name") |
equals() | Deep equality comparison for objects and arrays | equals({ a: 1 }, { a: 1 }) → true |
CSS variables
Theme every pixel with 19 CSS variables. Override them at :root or scope them to a wrapper.
Tooltip
Theming tokens for the [tooltip] directive.
| Variable | Default | Type | Description |
|---|---|---|---|
--hub-tooltip-bg | var(--hub-ref-color-black, #000) | color | Tooltip background colour. var(--hub-sys-color-primary)#212529 |
--hub-tooltip-color | var(--hub-ref-color-white, #fff) | color | Tooltip text colour. #fff#f8f9fa |
--hub-tooltip-opacity | 0.9 | number | Opacity of the shown tooltip. 10.85 |
--hub-tooltip-padding-x | var(--hub-ref-space-2, 0.5rem) | length | Horizontal padding inside the tooltip. 0.75rem1rem |
--hub-tooltip-padding-y | var(--hub-ref-space-1, 0.25rem) | length | Vertical padding inside the tooltip. 0.375rem0.5rem |
--hub-tooltip-border-radius | var(--hub-sys-radius-md, 0.375rem) | length | Corner radius of the tooltip. 0.25rem999px |
--hub-tooltip-font-size | var(--hub-ref-font-size-sm, 0.875rem) | length | Font size of the tooltip text. 0.75rem1rem |
--hub-tooltip-font-weight | var(--hub-ref-font-weight-base, 400) | number | Font weight of the tooltip text. 500600 |
--hub-tooltip-line-height | var(--hub-ref-line-height-base, 1.5) | number | Line height of the tooltip text. 1.41.6 |
--hub-tooltip-max-width | 200px | length | Maximum width before the text wraps. 160px320px |
--hub-tooltip-zindex | var(--hub-sys-zindex-tooltip, 1080) | number | Stacking order of the tooltip element. 10802000 |
--hub-tooltip-transition-duration | 0.15s | transition | Fade in/out duration. 0.1s0.25s |
--hub-tooltip-shadow | none | shadow | Box shadow of the tooltip. var(--hub-sys-shadow)0 2px 8px rgba(0,0,0,.2) |
--hub-tooltip-font-family | var(--hub-ref-font-family-base, inherit) | string | Font family of the tooltip text. inheritmonospace |
Overlay
CSS variables consumed by the overlay/popup system (`.hub-overlay-container` / `.hub-overlay-backdrop`).
| Variable | Default | Type | Description |
|---|---|---|---|
--hub-overlay-bg | var(--hub-sys-surface-elevated, #f8f9fa) | color | Background of the overlay panel. #fffvar(--hub-sys-surface-page) |
--hub-overlay-border-radius | var(--hub-sys-radius-sm, 0.25rem) | length | Corner radius of the overlay panel. 0.5rem0 |
--hub-overlay-shadow | var(--hub-sys-shadow, 0 0.5rem 1rem rgba(0,0,0,.15)) | shadow | Elevation shadow of the overlay panel. var(--hub-sys-shadow-lg)none |
--hub-overlay-zindex | var(--hub-sys-zindex-dropdown, 1000) | number | Stacking order of the overlay panel. 10502000 |
--hub-overlay-backdrop-zindex | calc(var(--hub-sys-zindex-dropdown, 1000) - 1) | number | Stacking order of the overlay backdrop (just below the panel). 10491999 |
Styling and theming
No styling examples are documented yet. This section will include customization recipes and theming examples.