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

Black ForestFreiburg · Autumn 2026 Taken Nov 3, 2026. Oak and beech leaves turning amber along the trail.

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

Autumn forestAutumn 2026Image on top, 16 / 9Image below the content, fixed height.Autumn forest

Sizes

Size xsPadding scales with the card size.Size smPadding scales with the card size.Size mdPadding scales with the card size.Size lgPadding scales with the card size.Size xlPadding scales with the card size.

API reference

hb-card

PropertyDescriptionTypeDefault
[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

PropertyDescriptionTypeDefault
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

PropertyDescriptionTypeDefault
[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