Card

Card is a flexible container component.


import { CardModule } from 'primeng/card';

A simple Card is created with a header property along with the content as children.

Simple Card

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore sed consequuntur error repudiandae numquam deserunt quisquam repellat libero asperiores earum nam nobis, culpa ratione quam perferendis esse, cupiditate neque quas!


<p-card header="Simple Card">
    <p class="m-0">
        Lorem ipsum dolor sit amet...
    </p>
</p-card>

Card content can be customized further with subHeader, header and footer properties.

Card
Advanced Card
Card Subheader

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Inventore sed consequuntur error repudiandae numquam deserunt quisquam repellat libero asperiores earum nam nobis, culpa ratione quam perferendis esse, cupiditate neque quas!


<p-card header="Advanced Card" subheader="Card Subheader" [style]="{ width: '360px' }">
    <ng-template pTemplate="header">
        <img alt="Card" src="https://primefaces.org/cdn/primeng/images/card-ng.jpg" />
    </ng-template>
    <p>
        Lorem ipsum dolor sit amet...
    </p>
    <ng-template pTemplate="footer">
        <div class="flex gap-3 mt-1">
            <p-button label="Cancel" severity="secondary" class="w-full" styleClass="w-full" />
            <p-button label="Save" class="w-full" styleClass="w-full" />
        </div>
    </ng-template>
</p-card>

Following is the list of structural style classes, for theming classes visit theming page.

NameElement
p-cardContainer element.
p-card-headerTitle element.
p-card-subheaderSubtitle element.
p-card-contentContent of the card.
p-card-footerFooter of the card.

Screen Reader

A card can be utilized in many use cases as a result no role is enforced, in fact a role may not be necessary if the card is used for presentational purposes only. Any valid attribute is passed to the container element so if you require to use one of the landmark roles like region, you may use the role property.


<p-card role="region">
    Content
</p-card>

Keyboard Support

Component does not include any interactive elements.