Angular Portal and Overlay Rendering | ng-hub-ui-portal
Angular portal library for dynamic component, template and overlay rendering outside the current DOM tree with positioning control.
API reference
Inputs
animation
Type: boolean
If true, portal opening and closing will be animated. Default: true
ariaLabelledBy
Type: string
`aria-labelledby` attribute value to set on the portal window
ariaDescribedBy
Type: string
`aria-describedby` attribute value to set on the portal window
beforeDismiss
Type: () => boolean | Promise<boolean>
Callback right before the portal will be dismissed. Return false to prevent dismissal.
container
Type: string | HTMLElement
A selector specifying the element all new portal windows should be appended to. If not specified, will be `body`.
injector
Type: Injector
The `Injector` to use for portal content to enable dependency injection.
keyboard
Type: boolean
If true, the portal will be closed when Escape key is pressed. Default: true
scrollable
Type: boolean
Scrollable portal content (false by default).
windowClass
Type: string
A custom class to append to the portal window for custom styling and positioning.
portalDialogClass
Type: string
A custom class to append to the portal dialog container.
portalContentClass
Type: string
A custom class to append to the portal content wrapper.
headerSelector
Type: string
Custom selector for the header element of the portal window. Useful for targeting specific portal sections.
footerSelector
Type: string
Custom selector for the footer element of the portal window. Useful for targeting specific portal sections.
dismissSelector
Type: string
Custom selector for elements that can trigger the dismissal of the portal window. Default: `[data-dismiss="portal"]`
closeSelector
Type: string
Custom selector for elements that can trigger the closing of the portal window. Default: `[data-close="portal"]`
Outputs
No outputs documented yet.
Templates
Portal Template
Template reference that can be passed to the HubPortal service for dynamic rendering
Example:
CSS variables
Portal Base Variables
Core styling variables for portal structure and positioning
--portal-zindex
Type: number
Default:1050
Z-index of the portal overlay
--portal-padding
Type: length
Default:1rem
Default padding for portal content
--portal-margin
Type: length
Default:0.5rem
Margin around portal dialog
Portal Appearance
Variables controlling portal colors, borders, and visual effects
--portal-bg
Type: color
Default:#ffffff
Background color of portal content
--portal-color
Type: color
Default:#212529
Text color of portal content
--portal-border-color
Type: color
Default:#dee2e6
Border color of portal
--portal-border-width
Type: border
Default:1px
Border width of portal
--portal-border-radius
Type: border
Default:0.375rem
Border radius of portal corners
--portal-box-shadow
Type: shadow
Default:0 0.5rem 1rem rgba(0, 0, 0, 0.15)
Box shadow for portal elevation
Portal Header & Footer
Styling variables for portal header and footer sections
--portal-header-padding
Type: length
Default:1rem
Padding of portal header
--portal-header-border-color
Type: color
Default:#dee2e6
Border color of portal header
--portal-footer-padding
Type: length
Default:1rem
Padding of portal footer
--portal-footer-border-color
Type: color
Default:#dee2e6
Border color of portal footer
Backdrop & Overlay
Variables controlling backdrop appearance and behavior
--portal-backdrop-bg
Type: color
Default:rgba(0, 0, 0, 0.5)
Background color for portal backdrop
--portal-backdrop-zindex
Type: number
Default:1040
Z-index of the backdrop (must be lower than portal z-index)
Styling and theming
No styling examples are documented yet. This section will include customization recipes and theming examples.