import { Component } from '@angular/core';
import { WrCard, WrCardFooter, WrCardHeader } from 'ngwr/card';
@Component({ imports: [WrCard, WrCardFooter, WrCardHeader] })
export class MyComponent {}Card
A surface that groups related content.
Installation
Import the class, and @use the entry point in your global styles: without it the component renders unstyled.
Basic usage
<wr-card-header> and <wr-card-footer> are optional.
<wr-card>
<wr-card-header>
<h3>Settings</h3>
</wr-card-header>
<p>Body content.</p>
<wr-card-footer>
<button wr-btn type="button" color="primary">Save</button>
</wr-card-footer>
</wr-card>Without header / footer
<wr-card>
<p>Just a surface around content.</p>
</wr-card>Variants
hoverable for clickable cards, compact for tight layouts, loading covers the body with a spinner.
<wr-card hoverable>Click me</wr-card>
<wr-card [bordered]="false">No border</wr-card>
<wr-card compact>Tighter paddings</wr-card>
<wr-card [loading]="reloading()">
<p>Spinner overlay while data loads.</p>
</wr-card>API
| Name | Description | Type | Default |
|---|---|---|---|
bordered | 1px border around the surface. | boolean | true |
hoverable | Lift and shadow on hover, pointer cursor. | boolean | false |
loading | Spinner over a dimmed body. Sets aria-busy. | boolean | false |
compact | Half the padding. | boolean | false |
<wr-card-header> | Header slot (.wr-card__header). | component | — |
<wr-card-footer> | Footer slot (.wr-card__footer). | component | — |
CSS variables
Set these on the component's selector or a wrapper, not on :root: the defaults are declared on ngwr/card's own element.
| Variable | Default | Declared on |
|---|---|---|
--wr-card-bg | var(--wr-color-surface) | .wr-card |
--wr-card-border | var(--wr-border-base) | .wr-card |
--wr-card-color | var(--wr-color-on-surface) | .wr-card |
--wr-card-font-family | var(--wr-font-family-base) | .wr-card |
--wr-card-gap | var(--wr-space-sm) | .wr-card |
--wr-card-header-font-weight | var(--wr-font-weight-medium) | .wr-card |
--wr-card-padding-x | var(--wr-space-xl) | .wr-card +1 variant override |
--wr-card-padding-y | var(--wr-space-lg) | .wr-card +1 variant override |
--wr-card-radius | var(--wr-border-radius-base) | .wr-card |
--wr-card-shadow | var(--wr-shadow-xs) | .wr-card |
--wr-card-shadow-hover | var(--wr-shadow-overlay) | .wr-card |
See also
Component DescriptionsA read-only list of labels and their values.Component StatisticA key number with a label and an optional change.Component ListA list of rows with leading, body and trailing slots.Component CollapseA panel that opens and closes from its header.Component SkeletonA placeholder block shown while content loads.Animation Spotlight CardA card with a soft highlight that follows the pointer.