Angular Modal Component | ng-hub-ui-modal

Accessible Angular modal component with stacking, fullscreen mode, templates, keyboard handling and CSS variables for standalone apps.

API reference

Here's the full contract for modal: 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 modal in with 14 inputs. Bind them like any Angular @Input.

NameTypeDefaultDescription
animationbooleanIf true, modal opening and closing will be animated. Default: true
backdropboolean | "static"If true, the backdrop element will be created. Alternatively, specify "static" for a backdrop which doesn't close the modal on click. Default: true
centeredbooleanIf true, the modal will be centered vertically. Default: false
placementHubModalPlacementControls where the modal is placed within the viewport. Default: HubModalPlacement.Center
keyboardbooleanIf true, the modal will be closed when Escape key is pressed. Default: true
closeOnNavigationbooleanIf true, the modal will be closed when the user navigates back in browser history (history.back(), browser back button). Default: true
size"sm" | "lg" | "xl" | stringSize of the modal window
windowClassstringA custom class to append to the modal window
backdropClassstringA custom class to append to the modal backdrop
dismissSelectorstringCustom selector for elements that can trigger the dismissal of the modal window. Default: "[data-dismiss=\"modal\"]"
closeSelectorstringCustom selector for elements that can trigger the closing of the modal window. Default: "[data-close=\"modal\"]"
headerSelectorstringCustom selector for the header element of the modal window
footerSelectorstringCustom selector for the footer element of the modal window
dataanyAdditional data that needs to be passed to the modal window when it is opened

Outputs

No outputs documented yet.

Templates

Make it yours — 1 template slots let you project custom markup.

NameDescriptionExample
Modal TemplateTemplate reference that can be passed to the modal service<ng-template #modalTemplate let-close="close" let-dismiss="dismiss"> <div class="modal-header"> <h4 class="modal-title">Modal Title</h4> </div> <div class="modal-body"> Modal content goes here </div> <div class="modal-footer"> <button class="btn btn-secondary" (click)="dismiss()">Cancel</button> <button class="btn btn-primary" (click)="close('result')">OK</button> </div> </ng-template>