packages/components/eui-dimmer/dimmer.component.ts
A dimming overlay component that provides a semi-transparent backdrop over page content. Automatically integrates with browser navigation to manage dimmer state during back/forward actions. Commonly used to indicate loading states, modal overlays, or to draw attention to specific UI elements.
<eui-dimmer [isDimmerActive]="isLoading"></eui-dimmer>// Component
isLoading = false;
loadData(): void {
this.isLoading = true;
this.dataService.fetch().subscribe(() => {
this.isLoading = false;
});
}
// Template
<eui-dimmer [isDimmerActive]="isLoading"></eui-dimmer>
<button (click)="loadData()">Load Data</button>aria-busy="true" to parent container when dimmer is activeEuiAppShellService for centralized state managementeui-dimmer--active applied when active for custom styling| changeDetection | ChangeDetectionStrategy.Default |
| encapsulation | ViewEncapsulation.None |
| selector | eui-dimmer |
| styleUrls | ./dimmer.scss |
Properties |
Inputs |
HostBindings |
Accessors |
constructor()
|
|
Creates an instance of EuiDimmerComponent. Listens to router navigation events to handle dimmer state during navigation, particularly when the user navigates back in browser history. |
| e2eAttr |
Type : string
|
Default value : 'eui-dimmer'
|
|
E2E testing attribute for the component. |
| isDimmerActive |
Type : boolean
|
|
Gets the active state of the dimmer. |
| class |
Type : string
|
|
Gets the CSS classes to apply to the host element. Adds the 'eui-dimmer--active' class when the dimmer is active. |
| asService |
Type : unknown
|
Default value : inject(EuiAppShellService)
|
| isDimmerActive | ||||||||
getisDimmerActive()
|
||||||||
|
Gets the active state of the dimmer.
Returns :
boolean
|
||||||||
setisDimmerActive(value: BooleanInput)
|
||||||||
|
Sets the active state of the dimmer.
Parameters :
Returns :
void
|
| cssClasses |
getcssClasses()
|
|
Gets the CSS classes to apply to the host element. Adds the 'eui-dimmer--active' class when the dimmer is active.
Returns :
string
|