Card API
Import
Section titled “Import”Cimpress UI exports several card-related components:
Card: container component that displays a card.CardHeader: renders a card title with optional description, icon, and menu.CardContent: renders a single content section withinCard.Divider: renders a line between card sections to visually separate them.UNSTABLE_ActionCard: a card that performs an action or navigates when pressed. Accepts the same content asCard.
import { Card, CardContent, CardHeader, Divider, UNSTABLE_ActionCard } from '@cimpress-ui/react';Action cards
Section titled “Action cards”UNSTABLE_ActionCard renders a link when you pass an href, and a button otherwise.
Interactive elements are positioned above the action, so they stay usable. If you render a custom interactive element that doesn’t match these, set position: relative on it.
Accessibility notes
Section titled “Accessibility notes”Card collections should be grouped in HTML lists.
Cards shouldn’t be miniature web pages. Avoid too much functionality, and reduce tab stops to a minimum to simplify keyboard navigation through the card list.
Action cards use the title of their CardHeader as their accessible name, and the header description as their accessible description. If the card has no header, provide an aria-label or aria-labelledby.
API reference
Section titled “API reference”Groups related blocks of content into a single unit.
- Ref<HTMLDivElement>
The
reftype for this component.
CardProps
- ReactNode
children *
Section titled “children * ” The contents of the card.
- string
The element's unique identifier. See MDN.
- boolean
data-cim-style-root
Section titled “data-cim-style-root” Use this attribute to "claim" the component tree for exclusive Cimpress UI usage.
- string
UNSAFE_className
Section titled “UNSAFE_className” Sets the CSS className for the element. Only use as a last resort. Use style props instead.
See styling guide.
- CSSProperties
UNSAFE_style
Section titled “UNSAFE_style” Sets the CSS style for the element. Only use as a last resort. Use style props instead.
See styling guide.
StyleProps
- Responsive<Spacing | "auto">
margin
Section titled “margin” The amount of margin applied to all edges of this component.
- Responsive<Spacing | "auto">
marginX
Section titled “marginX” The amount of margin applied to the left and right edges of this component. Takes priority over
margin.- Responsive<Spacing | "auto">
marginY
Section titled “marginY” The amount of margin applied to the top and bottom edges of this component. Takes priority over
margin.- Responsive<Spacing | "auto">
marginTop
Section titled “marginTop” The amount of margin applied to the top edge of this component. Takes priority over
marginYandmargin.- Responsive<Spacing | "auto">
marginRight
Section titled “marginRight” The amount of margin applied to the right edge of this component. Takes priority over
marginXandmargin.- Responsive<Spacing | "auto">
marginBottom
Section titled “marginBottom” The amount of margin applied to the bottom edge of this component. Takes priority over
marginYandmargin.- Responsive<Spacing | "auto">
marginLeft
Section titled “marginLeft” The amount of margin applied to the left edge of this component. Takes priority over
marginXandmargin.
CardHeader
Section titled “CardHeader”Renders a header within a Card.
CardHeaderProps
- ReactNode
title *
Section titled “title * ” The title of the card. Optionally, you can pass a React node to render a link.
Examples:<CardHeader title="Card title" /><CardHeader title={<Link href="#">Card title</Link>} />- ReactNode
iconStart
Section titled “iconStart” The icon to display at the start of the header.
- ReactNode
description
Section titled “description” The description of the card. Optionally, you can pass a React node to render rich text.
Examples:<CardHeader title="Card title" description="Card subtitle" /><CardHeader title="Card title" description={<Link href="#">Card subtitle</Link>} />- ReactNode
The tools to render at the end of the header. Usually a menu, icon button, or badge. For buttons, use the "small" size variant.
Examples:<CardHeader title="Card title" tools={<IconButton size="small" icon={<IconRatingStar />} aria-label="Favorite" />} />- string
The element's unique identifier. See MDN.
- boolean
data-cim-style-root
Section titled “data-cim-style-root” Use this attribute to "claim" the component tree for exclusive Cimpress UI usage.
- string
UNSAFE_className
Section titled “UNSAFE_className” Sets the CSS className for the element. Only use as a last resort. Use style props instead.
See styling guide.
- CSSProperties
UNSAFE_style
Section titled “UNSAFE_style” Sets the CSS style for the element. Only use as a last resort. Use style props instead.
See styling guide.
CardContent
Section titled “CardContent”Renders a single block of content within Card.
CardContentProps
- ReactNode
children *
Section titled “children * ” The content of this block.
- boolean
fullBleed
Section titled “fullBleed” - Defaults to false .
Whether the block's content should stretch to the edges of the block.
- string
The element's unique identifier. See MDN.
- boolean
data-cim-style-root
Section titled “data-cim-style-root” Use this attribute to "claim" the component tree for exclusive Cimpress UI usage.
- string
UNSAFE_className
Section titled “UNSAFE_className” Sets the CSS className for the element. Only use as a last resort. Use style props instead.
See styling guide.
- CSSProperties
UNSAFE_style
Section titled “UNSAFE_style” Sets the CSS style for the element. Only use as a last resort. Use style props instead.
See styling guide.
Divider
Section titled “Divider”Renders a divider between adjacent content.
- Ref<HTMLDivElement>
The
reftype for this component.
DividerProps
- 'vertical' | 'horizontal'
orientation
Section titled “orientation” - Defaults to 'horizontal' .
The orientation of the divider (horizontal or vertical).
- string
The element's unique identifier. See MDN.
- boolean
data-cim-style-root
Section titled “data-cim-style-root” Use this attribute to "claim" the component tree for exclusive Cimpress UI usage.
- string
UNSAFE_className
Section titled “UNSAFE_className” Sets the CSS className for the element. Only use as a last resort. Use style props instead.
See styling guide.
- CSSProperties
UNSAFE_style
Section titled “UNSAFE_style” Sets the CSS style for the element. Only use as a last resort. Use style props instead.
See styling guide.
StyleProps
- Responsive<Spacing | "auto">
margin
Section titled “margin” The amount of margin applied to all edges of this component.
- Responsive<Spacing | "auto">
marginX
Section titled “marginX” The amount of margin applied to the left and right edges of this component. Takes priority over
margin.- Responsive<Spacing | "auto">
marginY
Section titled “marginY” The amount of margin applied to the top and bottom edges of this component. Takes priority over
margin.- Responsive<Spacing | "auto">
marginTop
Section titled “marginTop” The amount of margin applied to the top edge of this component. Takes priority over
marginYandmargin.- Responsive<Spacing | "auto">
marginRight
Section titled “marginRight” The amount of margin applied to the right edge of this component. Takes priority over
marginXandmargin.- Responsive<Spacing | "auto">
marginBottom
Section titled “marginBottom” The amount of margin applied to the bottom edge of this component. Takes priority over
marginYandmargin.- Responsive<Spacing | "auto">
marginLeft
Section titled “marginLeft” The amount of margin applied to the left edge of this component. Takes priority over
marginXandmargin.
UNSTABLE_ActionCard
Section titled “UNSTABLE_ActionCard”A card that performs an action or navigates when pressed. Accepts the same content as Card,
and can contain other interactive elements such as buttons and links.
- Ref<HTMLDivElement>
The
reftype for this component.
UNSTABLE_ActionCardProps
- ReactNode
children *
Section titled “children * ” The contents of the card.
- (props: (DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>) | (DetailedHTMLProps<LinkWithRequiredHref, HTMLAnchorElement>), renderProps: LinkRenderProps) => ReactElement
render
Section titled “render” Renders a custom element, e.g. your router's link component. Render an
<a>if'href' in props, otherwise a<span>. Only used whenhrefis provided.- string
The element's unique identifier. See MDN.
- boolean
data-cim-style-root
Section titled “data-cim-style-root” Use this attribute to "claim" the component tree for exclusive Cimpress UI usage.
- string
UNSAFE_className
Section titled “UNSAFE_className” Sets the CSS className for the element. Only use as a last resort. Use style props instead.
See styling guide.
- CSSProperties
UNSAFE_style
Section titled “UNSAFE_style” Sets the CSS style for the element. Only use as a last resort. Use style props instead.
See styling guide.
- string
aria-label
Section titled “aria-label” Defines a string value that labels the current element.
- string
aria-labelledby
Section titled “aria-labelledby” Identifies the element (or elements) that labels the current element.
- string
aria-describedby
Section titled “aria-describedby” Identifies the element (or elements) that describes the object.
- string
aria-details
Section titled “aria-details” Identifies the element (or elements) that provide a detailed, extended description for the object.
- string
A URL to link to.
- undefined
routerOptions
Section titled “routerOptions” Options for the configured client side router.
- string
hrefLang
Section titled “hrefLang” Hints at the human language of the linked URL. SeeMDN.
- HTMLAttributeAnchorTarget
target
Section titled “target” The target window for the link. See MDN.
- string
The relationship between the linked resource and the current page. See MDN.
- string | boolean
download
Section titled “download” Causes the browser to download the linked URL. A string may be provided to suggest a file name. See MDN.
- string
A space-separated list of URLs to ping when the link is followed. See MDN.
- HTMLAttributeReferrerPolicy
referrerPolicy
Section titled “referrerPolicy” How much of the referrer to send when following the link. See MDN.
- (e: HoverEvent) => void
onHoverStart
Section titled “onHoverStart” Handler that is called when a hover interaction starts.
- (e: HoverEvent) => void
onHoverEnd
Section titled “onHoverEnd” Handler that is called when a hover interaction ends.
- (e: PressEvent) => void
onPress
Section titled “onPress” Handler that is called when the press is released over the target.
StyleProps
- Responsive<Spacing | "auto">
margin
Section titled “margin” The amount of margin applied to all edges of this component.
- Responsive<Spacing | "auto">
marginX
Section titled “marginX” The amount of margin applied to the left and right edges of this component. Takes priority over
margin.- Responsive<Spacing | "auto">
marginY
Section titled “marginY” The amount of margin applied to the top and bottom edges of this component. Takes priority over
margin.- Responsive<Spacing | "auto">
marginTop
Section titled “marginTop” The amount of margin applied to the top edge of this component. Takes priority over
marginYandmargin.- Responsive<Spacing | "auto">
marginRight
Section titled “marginRight” The amount of margin applied to the right edge of this component. Takes priority over
marginXandmargin.- Responsive<Spacing | "auto">
marginBottom
Section titled “marginBottom” The amount of margin applied to the bottom edge of this component. Takes priority over
marginYandmargin.- Responsive<Spacing | "auto">
marginLeft
Section titled “marginLeft” The amount of margin applied to the left edge of this component. Takes priority over
marginXandmargin.