Skip to main content
Version: 1.x

fast-card

The fast-card component is a visual container without semantics that takes children. Cards are snapshots of content that are typically used in a group to present collections of related information.

Setup

import {
provideFASTDesignSystem,
fastCard
} from "@microsoft/fast-components";

provideFASTDesignSystem()
.register(
fastCard()
);

Usage

Live Editor
<fast-card>
    <h3>Card title</h3>
    <p>At purus lectus quis habitant commodo, cras. Aliquam malesuada velit a tortor. Felis orci tellus netus risus et ultricies augue aliquet.</p>
    <fast-button>Learn more</fast-button>
</fast-card>
Result
Loading...

Create your own design

import {
Card,
cardTemplate as template,
} from "@microsoft/fast-foundation";
import { cardStyles as styles } from "./my-card.styles";

export const myCard = Card.compose({
baseName: "card",
template,
styles,
});

API

class: Card

Superclass

NameModulePackage
FoundationElement/src/foundation-element/foundation-element.js

Fields

NamePrivacyTypeDefaultDescriptionInherited From
$presentationpublicComponentPresentation or nullA property which resolves the ComponentPresentation instance for the current component.FoundationElement
templatepublicElementViewTemplate or void or nullSets the template of the element instance. When undefined, the element will attempt to resolve the template from the associated presentation or custom element definition.FoundationElement
stylespublicElementStyles or void or nullSets the default styles for the element instance. When undefined, the element will attempt to resolve default styles from the associated presentation or custom element definition.FoundationElement

Methods

NamePrivacyDescriptionParametersReturnInherited From
templateChangedprotectedvoidFoundationElement
stylesChangedprotectedvoidFoundationElement

Slots

NameDescription
The default slot for the card content

Additional resources