import { Component, ChangeDetectionStrategy } from '@angular/core'; import { CommonModule } from '@angular/common'; import { CardComponent, GlassVariant } from '../../../../../ui-essentials/src/lib/components/data-display/card'; import { ButtonComponent } from '../../../../../ui-essentials/src/lib/components/buttons'; @Component({ selector: 'ui-card-demo', standalone: true, imports: [ CommonModule, CardComponent, ButtonComponent ], changeDetection: ChangeDetectionStrategy.OnPush, template: `
Default elevated card with shadow
This is the most common card variant with a subtle elevation that lifts it above the surface.
Card with background color
Filled cards use background color to separate content from the surrounding surface.
Card with border emphasis
Outlined cards use borders to separate content while maintaining a clean appearance.
Compact card for minimal content.
Standard card size for most use cases with balanced spacing.
Spacious card for detailed content with generous padding and larger typography.
No shadow
Subtle shadow
Moderate shadow
Prominent shadow
Deep shadow
Sharp corners
Subtle rounding
Standard rounding
Generous rounding
Circle
Click me!
This card responds to clicks and has hover effects. Try clicking or focusing with keyboard.
Cannot interact
This card is disabled and cannot be interacted with.
Glass morphism effects using semantic design tokens from the shared-ui library. Each variant offers different levels of transparency and blur effects.
Ultra-light transparency
Barely visible background with subtle blur effect for minimal visual interference. Perfect for overlays that need to preserve background visibility.
Gentle transparency
Gentle glass effect that maintains excellent readability while adding modern depth. Ideal for cards that need subtle separation from background.
Balanced effect
Perfect balance between visibility and glass morphism effect. The most versatile variant suitable for most interface components.
Strong presence
Prominent glass effect with substantial background presence. Great for important UI elements that need to stand out prominently.
Maximum opacity with enhanced blur
Nearly opaque with enhanced blur for a true frosted glass appearance. Perfect for modals, overlays, and primary interface panels.
Glass effects with full interactivity, smooth animations, and hover states.
Interactive with smooth animations
Click me! Light glass variant with full interactivity and animation support. Features hover effects and touch feedback.
Strong glass with responsive feedback
Heavy glass variant combining strong visual presence with responsive interactions. Perfect for call-to-action cards and important interactive elements.
Medium glass with keyboard navigation
Medium glass effect with complete accessibility support including keyboard navigation, focus states, and screen reader compatibility.
Enhanced Glass System: All glass effects now use semantic design tokens from the shared-ui library, ensuring consistent theming, better performance, and improved browser compatibility.
@include glass-{{ '{' }}variant{{ '}' }}(true) mixinswill-change and isolationBeautiful gradient overlay
This card has a gradient background layer that creates visual depth and interest.
Custom pattern design
Click me! Cards can have complex patterns and remain fully interactive with proper layering.
<ui-card variant="elevated" size="md" elevation="sm" radius="md">
<div slot="header">
<h4>Card Title</h4>
<p>Card subtitle</p>
</div>
<p>Card content goes here</p>
<div slot="footer">
<ui-button variant="filled">Action</ui-button>
</div>
</ui-card>
<ui-card
variant="elevated"
[clickable]="true"
(cardClick)="handleCardClick($event)">
<p>Click me!</p>
</ui-card>
<ui-card
variant="elevated"
[glass]="true"
glassVariant="medium"
elevation="md"
radius="lg">
<p>Glass morphism effect with semantic tokens</p>
</ui-card>
<!-- All glass variants using semantic design tokens -->
<ui-card [glass]="true" glassVariant="translucent">Ultra-light transparency</ui-card>
<ui-card [glass]="true" glassVariant="light">Gentle glass effect</ui-card>
<ui-card [glass]="true" glassVariant="medium">Balanced glass morphism</ui-card>
<ui-card [glass]="true" glassVariant="heavy">Strong visual presence</ui-card>
<ui-card [glass]="true" glassVariant="frosted">Maximum opacity with blur</ui-card>
<ui-card
variant="elevated"
[glass]="true"
glassVariant="light"
[clickable]="true"
(cardClick)="handleCardClick($event)"
elevation="lg"
radius="lg">
<p>Clickable glass card with animations</p>
</ui-card>
<ui-card
variant="elevated"
[hasBackgroundLayer]="true"
[hasHeader]="true">
<div slot="background">
<!-- Background content -->
</div>
<div slot="header">
<h4>Card with Background</h4>
</div>
<p>Content over background</p>
</ui-card>