A card is a flexible content container used to group related information and actions about a single subject.
Cards help organize and present information in a clear and visually appealing way. There are two styles: default (filled) and stroked, and can include images, text, lists, actions, or even other components.
Default (filled) card
This covered, public space not only marks the entrance to the exhibitions, but also functions as a meeting place for locals and visitors. The architects called the prominent hole in the middle the "Fenster zum Himmel" ("window to heaven").Basel Exhibition Centre
<daff-card>
<daff-image daffCardImage
src="https://images.unsplash.com/photo-1593519749347-80f101e93113?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=3774&q=80"
alt="Bottom up view of Basel exhibition centre"
width="1261"
height="946">
</daff-image>
<fa-icon daffCardIcon [icon]="faMapMarked"></fa-icon>
<div daffCardTagline>Basel, Switzerland</div>
<h4 daffCardTitle>Basel Exhibition Centre</h4>
<div daffCardContent>
<p>This covered, public space not only marks the entrance to the exhibitions, but also functions as a meeting place for locals and visitors.</p>
<p>The architects called the prominent hole in the middle the "Fenster zum Himmel" ("window to heaven").</p>
</div>
<div daffCardActions>
<button daff-button color="theme-contrast">Learn More</button>
</div>
</daff-card>
Stroked card
This covered, public space not only marks the entrance to the exhibitions, but also functions as a meeting place for locals and visitors. The architects called the prominent hole in the middle the "Fenster zum Himmel" ("window to heaven").Basel Exhibition Centre
<daff-stroked-card [color]="colorControl.value">
<daff-image daffCardImage
src="https://images.unsplash.com/photo-1593519749347-80f101e93113?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=3774&q=80"
alt="Bottom up view of Basel exhibition centre"
width="1261"
height="946">
</daff-image>
<div daffCardTagline>Basel, Switzerland</div>
<h4 daffCardTitle>Basel Exhibition Centre</h4>
<div daffCardContent>
<p>This covered, public space not only marks the entrance to the exhibitions, but also functions as a meeting place for locals and visitors. The architects called the prominent hole in the middle the "Fenster zum Himmel" ("window to heaven").</p>
</div>
</daff-stroked-card>
<select [formControl]="colorControl">
@for (option of options; track option) {
<option [value]="option.value">{{ option.label }}</option>
}
</select>
When to use
Import the card style(s) you need into a standalone component:
Available imports:
DAFF_CARD_COMPONENTSDAFF_STROKED_CARD_COMPONENTSDAFF_ALL_CARD_COMPONENTSimport { DAFF_CARD_COMPONENTS } from '@daffodil/design/card';
@Component({
selector: 'custom-component',
templateUrl: './custom-component.component.html',
imports: [
DAFF_CARD_COMPONENTS,
],
})
export class CustomComponent {}
To use card in a module, import DaffCardModule into your custom module:
import { NgModule } from '@angular/core';
import { DaffCardModule } from '@daffodil/design/card';
import { CustomComponent } from './custom.component';
@NgModule({
declarations: [
CustomComponent,
],
exports: [
CustomComponent,
],
imports: [
DaffCardModule,
],
})
export class CustomComponentModule { }
This method is deprecated. It's recommended to update all custom components to standalone.
A card consists of the following components, displayed in the order listed:
<daff-card> or <daff-stroked-card>: The main wrapper that holds all card content.
[daffCardImage]: Image element at the top of the card.
[daffCardIcon]: Displays a visual or branding element. Avoid using for interactive icons.
[daffCardTagline]: Short phrase that provides quick context.
[daffCardTitle]: The primary heading of the card.
[daffCardContent]: Flexible container for body text or custom content. It's unstyled except for spacing and should only be used once per card.
[daffCardActions]: Container for buttons or links, positioned at the bottom.
<daff-card>
<img daffCardImage src="/product.jpg" alt="Product image">
<div daffCardIcon>
<fa-icon [icon]="faStar"></fa-icon>
</div>
<div daffCardTagline>New Arrival</div>
<h4 daffCardTitle>Product Name</h4>
<div daffCardContent>
<p>Product description and details.</p>
</div>
<div daffCardActions>
<button>View Details</button>
<button>Add to Cart</button>
</div>
</daff-card>
An interactive card turns the entire card into a clickable area that navigates to another page or view. This is useful for cards representing products, articles, or other resources where selecting the card should take the user to another page or section.
To create an interactive card, apply the component selector to an <a> element. All card styles support interactive behavior.
This covered, public space not only marks the entrance to the exhibitions, but also functions as a meeting place for locals and visitors. The architects called the prominent hole in the middle the "Fenster zum Himmel" ("window to heaven"). This covered, public space not only marks the entrance to the exhibitions, but also functions as a meeting place for locals and visitors. The architects called the prominent hole in the middle the "Fenster zum Himmel" ("window to heaven").Basel Exhibition Centre
Basel Exhibition Centre
<a daff-card href="https://www.basel.com/en/attractions/basel-exhibition-centre-f45d5dd6f0" target="_blank" [color]="basicColorControl.value">
<daff-image daffCardImage
src="https://images.unsplash.com/photo-1593519749347-80f101e93113?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=3774&q=80"
alt="Bottom up view of Basel exhibition centre"
width="1261"
height="946">
</daff-image>
<div daffCardTagline>Basel, Switzerland</div>
<h4 daffCardTitle>Basel Exhibition Centre</h4>
<div daffCardContent>
<p>This covered, public space not only marks the entrance to the exhibitions, but also functions as a meeting place for locals and visitors. The architects called the prominent hole in the middle the "Fenster zum Himmel" ("window to heaven").</p>
</div>
</a>
<select [formControl]="basicColorControl">
@for (option of options; track option) {
<option [value]="option.value">{{ option.label }}</option>
}
</select>
<a daff-stroked-card href="https://www.basel.com/en/attractions/basel-exhibition-centre-f45d5dd6f0" target="_blank" [color]="strokedColorControl.value">
<daff-image daffCardImage
src="https://images.unsplash.com/photo-1593519749347-80f101e93113?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=3774&q=80"
alt="Bottom up view of Basel exhibition centre"
width="1261"
height="946">
</daff-image>
<div daffCardTagline>Basel, Switzerland</div>
<h4 daffCardTitle>Basel Exhibition Centre</h4>
<div daffCardContent>
<p>This covered, public space not only marks the entrance to the exhibitions, but also functions as a meeting place for locals and visitors. The architects called the prominent hole in the middle the "Fenster zum Himmel" ("window to heaven").</p>
</div>
</a>
<select [formControl]="strokedColorControl">
@for (option of options; track option) {
<option [value]="option.value">{{ option.label }}</option>
}
</select>
Use the elevated property to add shadows to cards.
This covered, public space not only marks the entrance to the exhibitions, but also functions as a meeting place for locals and visitors. The architects called the prominent hole in the middle the "Fenster zum Himmel" ("window to heaven"). This covered, public space not only marks the entrance to the exhibitions, but also functions as a meeting place for locals and visitors. The architects called the prominent hole in the middle the "Fenster zum Himmel" ("window to heaven").Basel Exhibition Centre
Basel Exhibition Centre
<daff-card [elevated]="true">
<daff-image daffCardImage
src="https://images.unsplash.com/photo-1593519749347-80f101e93113?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=3774&q=80"
alt="Bottom up view of Basel exhibition centre"
width="1261"
height="946">
</daff-image>
<div daffCardTagline>Basel, Switzerland</div>
<h4 daffCardTitle>Basel Exhibition Centre</h4>
<div daffCardContent>
<p>This covered, public space not only marks the entrance to the exhibitions, but also functions as a meeting place for locals and visitors. The architects called the prominent hole in the middle the "Fenster zum Himmel" ("window to heaven").</p>
</div>
</daff-card>
<daff-stroked-card [elevated]="true">
<daff-image daffCardImage
src="https://images.unsplash.com/photo-1593519749347-80f101e93113?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=3774&q=80"
alt="Bottom up view of Basel exhibition centre"
width="1261"
height="946">
</daff-image>
<div daffCardTagline>Basel, Switzerland</div>
<h4 daffCardTitle>Basel Exhibition Centre</h4>
<div daffCardContent>
<p>This covered, public space not only marks the entrance to the exhibitions, but also functions as a meeting place for locals and visitors. The architects called the prominent hole in the middle the "Fenster zum Himmel" ("window to heaven").</p>
</div>
</daff-stroked-card>
Use the orientation property to stack card content either vertical (default) or horizontal. Horizontal cards automatically switch to vertical on smaller screens.
This covered, public space not only marks the entrance to the exhibitions, but also functions as a meeting place for locals and visitors. The architects called the prominent hole in the middle the "Fenster zum Himmel" ("window to heaven").Basel Exhibition Centre
<daff-card [orientation]="orientationControl.value">
<daff-image daffCardImage
src="https://images.unsplash.com/photo-1593519749347-80f101e93113?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=3774&q=80"
alt="Bottom up view of Basel exhibition centre"
width="1261"
height="946">
</daff-image>
<fa-icon daffCardIcon [icon]="faMapMarked"></fa-icon>
<div daffCardTagline>Basel, Switzerland</div>
<h4 daffCardTitle>Basel Exhibition Centre</h4>
<div daffCardContent>
<p>This covered, public space not only marks the entrance to the exhibitions, but also functions as a meeting place for locals and visitors. The architects called the prominent hole in the middle the "Fenster zum Himmel" ("window to heaven").</p>
</div>
<div daffCardActions>
<button daff-button color="theme-contrast">Learn More</button>
</div>
</daff-card>
<select [formControl]="orientationControl">
@for (option of options; track option) {
<option [value]="option.value">{{ option.label }}</option>
}
</select>
Cards default to a light gray background. Use the color property to change a card's color.
Cards are themable. Cards are themable.<daff-card [color]="cardControl.value">
<div daffCardTagline>Card Tagline</div>
<div daffCardTitle>Title</div>
<div daffCardContent>
<p>Cards are themable.</p>
</div>
</daff-card>
<select [formControl]="cardControl">
@for (option of options; track option) {
<option [value]="option.value">{{ option.label }}</option>
}
</select>
<daff-stroked-card [color]="strokedCardControl.value">
<div daffCardTagline>Card Tagline</div>
<div daffCardTitle>Title</div>
<div daffCardContent>
<p>Cards are themable.</p>
</div>
</daff-stroked-card>
<select [formControl]="strokedCardControl">
@for (option of options; track option) {
<option [value]="option.value">{{ option.label }}</option>
}
</select>