Jump to main content

Cards


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.

Default

The purpose of the default card is to display information, without user interaction.

Content bleed

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.

Image

Any images used as part of the card content should have a .p-card__image class name.

Highlighted

The purpose of the highlighted card should be used when you can interact with the content.

Overlay

The purpose of the overlay card is to make the text visible in conjunction with a strip image.

Import

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/scss/vanilla';
@include vf-base;

@include vf-p-card;

For more information see Customising Vanilla in your projects, which includes overrides and importing instructions.

React

You can use cards in React by installing our react-component library and importing Card component.

See the documentation for our React Card component