File

src/tiles/tile.component.ts

Description

Build application's tiles using this component. Get started with importing the module:

Example :
import { TilesModule } from 'carbon-components-angular';
Example :
<cds-tile>
        tile content
</cds-tile>

See demo

Metadata

Index

Properties
Inputs
HostBindings
Accessors

Inputs

decorator
Type : TemplateRef<any>

Experimental: Optional decorator (e.g. AI label).

hasRoundedCorners
Type : boolean
Default value : false

When true with a decorator, applies rounded-corner styling.

theme
Type : "light" | "dark"
Default value : "dark"

HostBindings

class.cds--tile
Type : boolean
Default value : true
class.cds--tile--decorator
Type : boolean
class.cds--tile--decorator-rounded
Type : boolean
class.cds--tile--light
Type : boolean

Properties

tileClass
Default value : true
Decorators :
@HostBinding('class.cds--tile')

Accessors

lightThemeEnabled
getlightThemeEnabled()
hasDecorator
gethasDecorator()
decoratorRounded
getdecoratorRounded()
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";
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""