Card
A bordered container with header, content and footer slots.
View as MarkdownExample
- Preview
- Code
Installation
npx fizzy-ui add card Copies card.ts into src/app/ui/ and installs what it needs. Run init once first.
Accessibility
No axe-core violations axe-core 4.14.0 checks this example, closed and with its panels open, on every build; the site is not published otherwise.
- Pick the title element (h2, h3…) that fits the page outline.
Source
The exact file add copies. It is yours to edit.
card.ts
import { Directive } from '@angular/core';
@Directive({ selector: '[fzCard]', host: { class: 'flex flex-col gap-6 rounded-lg border bg-background py-6 text-foreground shadow-sm' } })
export class FzCard {}
@Directive({ selector: '[fzCardHeader]', host: { class: 'flex flex-col gap-1.5 px-6' } })
export class FzCardHeader {}
@Directive({ selector: '[fzCardTitle]', host: { class: 'font-semibold leading-none' } })
export class FzCardTitle {}
@Directive({ selector: '[fzCardDescription]', host: { class: 'text-sm text-muted-foreground' } })
export class FzCardDescription {}
@Directive({ selector: '[fzCardContent]', host: { class: 'px-6' } })
export class FzCardContent {}
@Directive({ selector: '[fzCardFooter]', host: { class: 'flex items-center gap-2 px-6' } })
export class FzCardFooter {}
export const FZ_CARD = [FzCard, FzCardHeader, FzCardTitle, FzCardDescription, FzCardContent, FzCardFooter] as const;