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
Inputs
animation
Type: boolean
If true, modal opening and closing will be animated. Default: true
backdrop
Type: boolean | "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
centered
Type: boolean
If true, the modal will be centered vertically. Default: false
placement
Type: HubModalPlacement
Controls where the modal is placed within the viewport. Default: HubModalPlacement.Center
keyboard
Type: boolean
If true, the modal will be closed when Escape key is pressed. Default: true
closeOnNavigation
Type: boolean
If true, the modal will be closed when the user navigates back in browser history (history.back(), browser back button). Default: true
size
Type: "sm" | "lg" | "xl" | string
Size of the modal window
windowClass
Type: string
A custom class to append to the modal window
backdropClass
Type: string
A custom class to append to the modal backdrop
dismissSelector
Type: string
Custom selector for elements that can trigger the dismissal of the modal window. Default: "[data-dismiss=\"modal\"]"
closeSelector
Type: string
Custom selector for elements that can trigger the closing of the modal window. Default: "[data-close=\"modal\"]"
headerSelector
Type: string
Custom selector for the header element of the modal window
footerSelector
Type: string
Custom selector for the footer element of the modal window
data
Type: any
Additional data that needs to be passed to the modal window when it is opened
Outputs
No outputs documented yet.
Templates
Modal Template
Template reference that can be passed to the modal service
Example:
CSS variables
Modal Base Variables
Core styling variables for modal structure and positioning
--bs-modal-zindex
Type: number
Default:1055
Z-index of the modal
--bs-modal-width
Type: length
Default:500px
Default modal width
--bs-modal-padding
Type: length
Default:1rem
Padding around modal content
--bs-modal-margin
Type: length
Default:0.5rem
Margin around modal dialog
Modal Appearance
Variables controlling modal colors, borders, and visual effects
--bs-modal-color
Type: color
Default:var(--bs-body-color)
Text color of modal content
--bs-modal-bg
Type: color
Default:var(--bs-body-bg)
Background color of modal content
--bs-modal-border-color
Type: color
Default:var(--bs-border-color-translucent)
Border color of modal
--bs-modal-border-width
Type: border
Default:var(--bs-border-width)
Border width of modal
--bs-modal-border-radius
Type: border
Default:var(--bs-border-radius-lg)
Border radius of modal
--bs-modal-box-shadow
Type: shadow
Default:0 0.125rem 0.25rem rgba(0, 0, 0, 0.075)
Box shadow of modal
Modal Header
Styling variables for modal header section
--bs-modal-header-padding-x
Type: length
Default:1rem
Horizontal padding of modal header
--bs-modal-header-padding-y
Type: length
Default:1rem
Vertical padding of modal header
--bs-modal-header-border-color
Type: color
Default:var(--bs-border-color)
Border color of modal header
--bs-modal-header-border-width
Type: border
Default:0 0 var(--bs-border-width) 0
Border width of modal header
Modal Footer
Styling variables for modal footer section
--bs-modal-footer-gap
Type: length
Default:0.5rem
Gap between elements in modal footer
--bs-modal-footer-border-color
Type: color
Default:var(--bs-border-color)
Border color of modal footer
--bs-modal-footer-border-width
Type: border
Default:var(--bs-border-width) 0 0 0
Border width of modal footer
Styling and theming
No styling examples are documented yet. This section will include customization recipes and theming examples.