Component
Card
A surface that groups related content. Compose it from a header (title, description, action), content, footer, and an optional image, at five sizes.
Anatomy & action
Options opened 0×
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { NgIcon, provideIcons } from '@ng-icons/core';
import { phosphorDotsThree } from '@ng-icons/phosphor-icons/regular';
import { HbButtonComponent, HbCardImports } from '@herbst/ui';
@Component({
selector: 'hb-demo-card-anatomy',
imports: [HbCardImports, HbButtonComponent, NgIcon],
providers: [provideIcons({ phosphorDotsThree })],
template: `
<div class="flex flex-col gap-2">
<hb-card class="max-w-sm">
<hb-card-header hbBorder>
<hb-card-title>Black Forest</hb-card-title>
<hb-card-description>Freiburg · Autumn 2026</hb-card-description>
<button
hb-button
hbType="ghost"
hbSize="icon"
hb-card-action
aria-label="Options"
(hbActionClick)="opened.set(opened() + 1)"
>
<ng-icon name="phosphorDotsThree" />
</button>
</hb-card-header>
<hb-card-content>
Taken Nov 3, 2026. Oak and beech leaves turning amber along the trail.
</hb-card-content>
<hb-card-footer hbBorder class="justify-end gap-2">
<button hb-button hbType="ghost" hbSize="sm">Discard</button>
<button hb-button hbSize="sm">Save</button>
</hb-card-footer>
</hb-card>
<p class="font-mono text-[12px] text-muted-foreground">Options opened {{ opened() }}×</p>
</div>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HbDemoCardAnatomyComponent {
protected readonly opened = signal(0);
}
Image
Sizes
API reference
hb-card
| Property | Description | Type | Default |
|---|---|---|---|
| [hbSize] | Padding scale of the card and its sections. | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'md' |
| [class] | Extra CSS classes merged onto the card. | string | '' |
Sections
| Property | Description | Type | Default |
|---|---|---|---|
| hb-card-header [hbBorder] | Header block; hbBorder adds a bottom divider. | boolean | false |
| hb-card-title / hb-card-description | Heading and muted subtitle inside the header. | slot | — |
| [hb-card-action] (hbActionClick) | Action pinned to the top-right of the header; emits on click. | void | — |
| hb-card-content | Main body of the card. | slot | — |
| hb-card-footer [hbBorder] | Footer block; hbBorder adds a top divider. | boolean | false |
hb-card-image
| Property | Description | Type | Default |
|---|---|---|---|
| [hbSrc] / [hbAlt] | Image source and alt text. | string | '' |
| [hbPosition] | Place the image above or below the card body. | 'top' | 'bottom' | 'top' |
| [hbFit] | How the image fills its box. | 'cover' | 'contain' | 'cover' |
| [hbRatio] | Aspect ratio of the image box. | number | null | null |
| [hbHeight] | Fixed image height in pixels (overrides ratio). | number | 0 |