Card

Group related content for easier scannability in a styled, often interactive box.

Import

import { Card } from '@contentful/f36-components';
// or
import { Card } from '@contentful/f36-card';

Examples

Here you will find the most common ways of using the Card component.

With onClick

It’s possible to call an action when the user clicks on the Card. To do that, you only need to pass a function to the onClick prop.

Selectable cards

Sometimes you will need to use the Card as an selectable element in the UI. To achieve that behaviour, you should use a combination of the onClick and isSelected props. The former controlling the latter.

A Card can be used with the purpose to navigate a user to an external page. To do that a user must pass a value to the href prop. Optionally, the user can pass a target prop to control how the link should be open. By default Card is rendered as article html tag, in order to render it as a link, you should pass as="a" to Card component.

With a custom drag handle

When using the withDragHandle prop on the Card, you can also pass a custom drag handle render function. This is useful for more advanced use cases such as supporting keyboard navigation, where you would want to handle key events on the drag handle component. When using a custom drag handle, you should pass padding="none" to the Card to make sure the drag handle does not render inside the Card's content.

Props (API reference)

Open in Storybook