src/accordion/accordion.component.ts
Get started with importing the module:
Example :import { AccordionModule } from 'carbon-components-angular';
AfterContentInit
selector | cds-accordion, ibm-accordion |
template |
|
Properties |
Methods |
|
Inputs |
Accessors |
align | |
Type : "start" | "end"
|
|
Default value : "end"
|
|
Defined in src/accordion/accordion.component.ts:42
|
|
Sets the alignment of the chevron icon |
size | |
Type : "sm" | "md" | "lg"
|
|
Default value : "md"
|
|
Defined in src/accordion/accordion.component.ts:50
|
skeleton | |
Type : any
|
|
Defined in src/accordion/accordion.component.ts:57
|
ngAfterContentInit |
ngAfterContentInit()
|
Defined in src/accordion/accordion.component.ts:66
|
Returns :
void
|
Protected updateChildren |
updateChildren()
|
Defined in src/accordion/accordion.component.ts:70
|
Returns :
void
|
Protected _skeleton |
Default value : false
|
Defined in src/accordion/accordion.component.ts:54
|
children |
Type : QueryList<AccordionItem>
|
Decorators :
@ContentChildren(AccordionItem)
|
Defined in src/accordion/accordion.component.ts:52
|
skeleton | ||||||
getskeleton()
|
||||||
Defined in src/accordion/accordion.component.ts:62
|
||||||
setskeleton(value: any)
|
||||||
Defined in src/accordion/accordion.component.ts:57
|
||||||
Parameters :
Returns :
void
|
import {
Component,
Input,
ContentChildren,
QueryList,
AfterContentInit
} from "@angular/core";
import { AccordionItem } from "./accordion-item.component";
/**
* Get started with importing the module:
*
* ```typescript
* import { AccordionModule } from 'carbon-components-angular';
* ```
*
* [See demo](../../?path=/story/components-accordion--basic)
*/
@Component({
selector: "cds-accordion, ibm-accordion",
template: `
<div class="cds--accordion"
[ngClass]="{
'cds--accordion--end': align === 'end',
'cds--accordion--start': align === 'start',
'cds--accordion--sm': size === 'sm',
'cds--accordion--md': size ==='md',
'cds--accordion--lg': size === 'lg',
'cds--layout--size-sm': size === 'sm',
'cds--layout--size-md': size === 'md',
'cds--layout--size-lg': size === 'lg'
}"
role="list">
<ng-content></ng-content>
</div>
`
})
export class Accordion implements AfterContentInit {
/**
* Sets the alignment of the chevron icon
*/
@Input() align: "start" | "end" = "end";
/**
* @todo remove `cds--accordion--${size}` classes in v12
*/
/**
* Sets the size of all accordian items
*/
@Input() size: "sm" | "md" | "lg" = "md";
@ContentChildren(AccordionItem) children: QueryList<AccordionItem>;
protected _skeleton = false;
@Input()
set skeleton(value: any) {
this._skeleton = value;
this.updateChildren();
}
get skeleton(): any {
return this._skeleton;
}
ngAfterContentInit() {
this.updateChildren();
}
protected updateChildren() {
if (this.children) {
this.children.toArray().forEach(child => child.skeleton = this.skeleton);
}
}
}