There are four card styles available to use in Vanilla: default, header, highlighted and overlay. Our card component will expand to fill the full width of its parent container.
The purpose of the default card is to display information, without user interaction.
It is possible to have content bleed to the edges by using u-no-padding
on the p-card
element. Any content that requires padding can then use the .p-card__inner
element.
The purpose of the header card is to display information, grouped under a heading.
Any images used as part of the card content should have a .p-card__image
class name.
The purpose of the highlighted card should be used when you can interact with the content.
The purpose of the overlay card is to make the text visible in conjunction with a strip image.
To import just this component into your project, copy the snippet below and include it in your main Sass file.
// import Vanilla and include base mixins
// this only needs to happen once in a given project
@import 'vanilla-framework';
@include vf-base;
@include vf-p-card;
For more information see Customising Vanilla in your projects, which includes overrides and importing instructions.
You can use cards in React by installing our react-component library and importing Card
component.