src/modal/modal-header.component.ts
Inputs
Example :<cds-modal-header>Header text</cds-modal-header>
Outputs
Example :<cds-modal-header (closeSelect)="closeModal()">Header text</cds-modal-header>
selector | cds-modal-header, ibm-modal-header |
template |
|
Properties |
Methods |
|
Inputs |
Outputs |
constructor(i18n: I18n)
|
||||||
Defined in src/modal/modal-header.component.ts:68
|
||||||
Parameters :
|
closeLabel | |
Type : any
|
|
Default value : this.i18n.get().MODAL.CLOSE
|
|
Defined in src/modal/modal-header.component.ts:51
|
|
Accessible label for the header close button.
Defaults to the |
showCloseButton | |
Type : boolean
|
|
Default value : true
|
|
Defined in src/modal/modal-header.component.ts:55
|
|
Set to |
theme | |
Type : string
|
|
Default value : "default"
|
|
Defined in src/modal/modal-header.component.ts:46
|
closeSelect | |
Type : EventEmitter
|
|
Defined in src/modal/modal-header.component.ts:60
|
|
To emit the event of clicking on the close icon within the modal. |
Public onClose |
onClose()
|
Defined in src/modal/modal-header.component.ts:75
|
Handles click for the close icon button within the
Returns :
void
|
buttonAttributes |
Type : object
|
Default value : {
"aria-label": this.i18n.get().MODAL.CLOSE
}
|
Defined in src/modal/modal-header.component.ts:66
|
buttonNgClass |
Type : object
|
Default value : {
"cds--modal-close": true
}
|
Defined in src/modal/modal-header.component.ts:62
|
import {
Component,
Output,
EventEmitter,
Input
} from "@angular/core";
import { I18n } from "carbon-components-angular/i18n";
/**
* ***Inputs***
* ```html
* <cds-modal-header>Header text</cds-modal-header>
* ```
*
* ***Outputs***
* ```html
* <cds-modal-header (closeSelect)="closeModal()">Header text</cds-modal-header>
* ```
*/
@Component({
selector: "cds-modal-header, ibm-modal-header",
template: `
<header class="cds--modal-header {{theme}}">
<ng-content></ng-content>
<div class="cds--modal-close-button">
<cds-icon-button
*ngIf="showCloseButton"
type="button"
[buttonNgClass]="buttonNgClass"
[buttonAttributes]="buttonAttributes"
align="left"
[description]="closeLabel"
(click)="onClose()">
<svg cdsIcon="close" size="20" class="cds--modal-close__icon"></svg>
</cds-icon-button>
</div>
</header>
`
})
export class ModalHeader {
/**
* @deprecated since v5
* Sets the style on the modal heading based on its category.
*/
@Input() theme = "default";
/**
* Accessible label for the header close button.
* Defaults to the `MODAL.CLOSE` value from the i18n service.
*/
@Input() closeLabel = this.i18n.get().MODAL.CLOSE;
/**
* Set to `false` to hide the close button.
*/
@Input() showCloseButton = true;
/**
* To emit the event of clicking on the close icon within the modal.
*/
@Output() closeSelect = new EventEmitter();
buttonNgClass = {
"cds--modal-close": true
};
buttonAttributes = {
"aria-label": this.i18n.get().MODAL.CLOSE
};
constructor(protected i18n: I18n) {}
/**
* Handles click for the close icon button within the `Modal`.
*/
public onClose() {
this.closeSelect.emit();
}
}