packages/components/eui-card/eui-card.component.ts
eui-card is a container component based on Material Design principles.
It provides a structured surface to group related content such as text, media, and actions around a single subject.
The component supports multiple visual states (selection, urgency, loading, disabled), sizes, collapsible behavior, and deterministic state synchronization through an internal UI state service.
It is designed to be structural, deterministic, and state-driven, without requiring custom CSS or inferred behavior.
<eui-card>
<eui-card-header>
<eui-card-header-title>Card Title</eui-card-header-title>
<eui-card-header-subtitle>Subtitle</eui-card-header-subtitle>
</eui-card-header>
<eui-card-content>
Card content goes here
</eui-card-content>
<eui-card-footer>
<button euiButton>Action</button>
</eui-card-footer>
</eui-card><eui-card
[euiCollapsible]="true"
[euiCollapsed]="isCollapsed"
(collapse)="onCollapse($event)">
<eui-card-header>
<eui-card-header-title>Collapsible Card</eui-card-header-title>
</eui-card-header>
<eui-card-content>Content that can be collapsed</eui-card-content>
</eui-card><eui-card [euiSelected]="true" [euiUrgent]="true">
<eui-card-header>
<eui-card-header-title>Important Card</eui-card-header-title>
</eui-card-header>
<eui-card-content>Urgent content</eui-card-content>
</eui-card><eui-card
[isClickeable]="true"
[euiHoverable]="true"
(cardClick)="onCardClick($event)">
<eui-card-content>Click me</eui-card-content>
</eui-card>onCollapse(isCollapsed: boolean): void {
console.log('Card collapsed:', isCollapsed);
}
onCardClick(card: EuiCardComponent): void {
console.log('Card clicked');
}
AfterContentInit
OnDestroy
OnInit
OnChanges
| changeDetection | ChangeDetectionStrategy.OnPush |
| HostDirectives |
BaseStatesDirective
Inputs : euiPrimary euiSecondary euiInfo euiSuccess euiWarning euiDanger euiHighlighted euiDisabled euiLoading euiSizeXS euiSizeS euiSizeM euiSizeL euiSizeXL euiSize2XL euiSizeVariant
|
| providers |
UiStateService
|
| selector | eui-card |
| imports |
NgTemplateOutlet
|
| templateUrl | ./eui-card.component.html |
| styleUrl | ./eui-card.scss |
Properties |
|
Inputs |
Outputs |
HostBindings |
Accessors |
| e2eAttr |
Type : string
|
Default value : 'eui-card'
|
|
Sets the |
| euiCollapsed |
Type : boolean
|
Default value : false
|
|
Sets the |
| euiCollapsible |
Type : boolean
|
Default value : false
|
|
Sets the |
| euiHoverable |
Type : boolean
|
Default value : false
|
|
Sets the |
| euiNoContentPadding |
Type : boolean
|
Default value : false
|
|
Sets the |
| euiNoShadow |
Type : boolean
|
Default value : false
|
|
Sets the |
| euiSelected |
Type : boolean
|
Default value : false
|
|
Sets the |
| euiUrgent |
Type : boolean
|
Default value : false
|
|
Sets the |
| hasLeftExpander |
Type : boolean
|
Default value : false
|
|
Sets the |
| isCompact |
Type : boolean
|
Default value : false
|
|
Input property to display the card header and content in compact view |
| collapse |
Type : EventEmitter<boolean>
|
|
Event emitted when the card collapses. |
| class |
Type : string
|
|
Computes and returns the CSS classes for the component based on its current state. |
| Public uiStateService |
Type : UiStateService
|
Default value : inject(UiStateService)
|
| cssClasses |
getcssClasses()
|
|
Computes and returns the CSS classes for the component based on its current state.
Returns :
string
|