src/tiles/tile.component.ts
Build application's tiles using this component. Get started with importing the module:
Example :import { TilesModule } from 'carbon-components-angular';<cds-tile>
tile content
</cds-tile>| selector | cds-tile, ibm-tile |
| template | |
Properties |
Inputs |
HostBindings |
Accessors |
| decorator | |
Type : TemplateRef<any>
|
|
|
Defined in src/tiles/tile.component.ts:52
|
|
|
Experimental: Optional decorator (e.g. AI label). |
|
| hasRoundedCorners | |
Type : boolean
|
|
Default value : false
|
|
|
Defined in src/tiles/tile.component.ts:57
|
|
|
When |
|
| theme | |
Type : "light" | "dark"
|
|
Default value : "dark"
|
|
|
Defined in src/tiles/tile.component.ts:63
|
|
| class.cds--tile |
Type : boolean
|
Default value : true
|
|
Defined in src/tiles/tile.component.ts:35
|
| class.cds--tile--decorator |
Type : boolean
|
|
Defined in src/tiles/tile.component.ts:41
|
| class.cds--tile--decorator-rounded |
Type : boolean
|
|
Defined in src/tiles/tile.component.ts:45
|
| class.cds--tile--light |
Type : boolean
|
|
Defined in src/tiles/tile.component.ts:37
|
| tileClass |
Default value : true
|
Decorators :
@HostBinding('class.cds--tile')
|
|
Defined in src/tiles/tile.component.ts:35
|
| lightThemeEnabled |
getlightThemeEnabled()
|
|
Defined in src/tiles/tile.component.ts:37
|
| hasDecorator |
gethasDecorator()
|
|
Defined in src/tiles/tile.component.ts:41
|
| decoratorRounded |
getdecoratorRounded()
|
|
Defined in src/tiles/tile.component.ts:45
|
import {
Component,
HostBinding,
Input,
TemplateRef
} from "@angular/core";
/**
* Build application's tiles using this component. Get started with importing the module:
*
* ```typescript
* import { TilesModule } from 'carbon-components-angular';
* ```
*
* ```html
* <cds-tile>
* tile content
* </cds-tile>
* ```
*
* [See demo](../../?path=/story/components-tiles--basic)
*/
@Component({
selector: "cds-tile, ibm-tile",
template: `
<ng-content></ng-content>
<ng-container *ngIf="decorator">
<div class="cds--tile--inner-decorator">
<ng-template [ngTemplateOutlet]="decorator"></ng-template>
</div>
</ng-container>
`
})
export class Tile {
@HostBinding("class.cds--tile") tileClass = true;
@HostBinding("class.cds--tile--light") get lightThemeEnabled() {
return this.theme === "light";
}
@HostBinding("class.cds--tile--decorator") get hasDecorator() {
return !!this.decorator;
}
@HostBinding("class.cds--tile--decorator-rounded") get decoratorRounded() {
return !!this.decorator && this.hasRoundedCorners;
}
/**
* **Experimental**: Optional decorator (e.g. AI label).
*/
@Input() decorator: TemplateRef<any>;
/**
* When `true` with a `decorator`, applies rounded-corner styling.
*/
@Input() hasRoundedCorners = false;
/**
* @deprecated since v5 - Use `cdsLayer` directive instead
* Set to `"light"` to apply the light style
*/
@Input() theme: "light" | "dark" = "dark";
}