Card
is a box of related content usually describing a single object. It can be composed of several subcomponents, we give full overview of those subcomponents below.
Card
supports vertical
and horizontal
orientation which is controlled by CardContext
, see examples below.
Basic Usage
Any Paragon component or export may be added to the code example.
Card variants
Use variant
prop to use Card
specific style variant.
Any Paragon component or export may be added to the code example.
Clickable card
You use isClickable
prop to add additional hover
and focus
styling to the Card
.
Any Paragon component or export may be added to the code example.
As link
You can also use Card
as a link by passing the value HyperLink
(or a
, Link
) to the as
property, note that
Card
will override the default link styling to make its content appear as regular text.
Any Paragon component or export may be added to the code example.
Header
You may add a header by adding a Card.Header
component.
This header displays a title, subtitle, and may contain actions.
Any Paragon component or export may be added to the code example.
Actions
The Card.Header
supports custom actions via the actions prop and renders them on the top right of the header.
Any Paragon component or export may be added to the code example.
Sizes
The Card.Header
supports two size variants, "sm"
and "md"
.
Add size="sm"
for smaller header content and actions.
Any Paragon component or export may be added to the code example.
Section
Card.Section
is the main block to display card content. Can include its own title and actions separate from other card components. Multiple sections have a Card.Divider
between them.
Any Paragon component or export may be added to the code example.
Footer
Card.Footer
is the bottom part of the card. Usually used to outline actions that can be taken on the card object.
Note that Card.Footer
has a separate orientation
prop which will override the value from CardContext
, this was implemented because there are some use cases where you would want to display Card
with horizontal orientation containing footer with vertical orientation.
Footer vertical variant
Any Paragon component or export may be added to the code example.
Footer horizontal variant
Any Paragon component or export may be added to the code example.
With Image Cap
ImageCap
is an image that sits on the top or the left edge of a Card
. Can contain an optional logo image.
Any Paragon component or export may be added to the code example.
Horizontal variant
When using horizontal variant Paragon provides additional component Card.Body
which acts as a wrapper for content you want to display between ImageCap
and Footer
. Use it if content contains multiple components.
Any Paragon component or export may be added to the code example.
Card status
Note that in the example below, the content of Card
is wrapped inside Card.Body
. The d-flex
class is added for the horizontal
orientation to achieve horizontal variant. The flex-column
class is added for the main Card
component.
An optional actions
prop may be passed to include call-to-action button(s).
Any Paragon component or export may be added to the code example.
Card Content Block Empty
With image
Any Paragon component or export may be added to the code example.
Without image
Any Paragon component or export may be added to the code example.
Horizontal variant with image
Any Paragon component or export may be added to the code example.
Horizontal variant without image
Any Paragon component or export may be added to the code example.
Fallback Image
With Fallback custom Image
You can specify fallbackSrc
image to show in case your main src
fails to load.
A fallback source is available for both the main ImageCap
component image and the logo.
Any Paragon component or export may be added to the code example.
With default Fallback Image
The default fallback image will be displayed if fallbackSrc
is not specified.
Any Paragon component or export may be added to the code example.
With loading state
Vertical variant
Any Paragon component or export may be added to the code example.
Horizontal variant
Any Paragon component or export may be added to the code example.
CardGrid
This component displays a collection of Cards as a grid (with customizable responsive behavior), where all cards in a given row have equal height. Try shrinking the width of your browser to view the responsive behavior.
Any Paragon component or export may be added to the code example.
CardDeck
Displays child Card
components in a horizontal row with equal height and width, with an appropriate gutter between cards. The width of each child Card
component is determined by the (optional) columnSizes
prop. If any child Card
components overflow beyond the parent's width, they will be hidden but accessible via scrolling horizontally or keyboard navigation.
For accessibility, if the child Card
components are interactive (e.g., isClickable
), pass the hasInteractiveChildren
prop so the CardDeck
itself isn't focusable.
Any Paragon component or export may be added to the code example.
CardCarousel
Extends CardDeck
to support navigating between any overflow Card
components via left and right IconButton
components as a scrollable carousel.
Includes support for an optional title
and subtitle
. You may rely on the default styles for the titles (e.g., if passing strings) or alternatively you may also pass custom HTML and JSX.
Any Paragon component or export may be added to the code example.
Theme Variables#
CSS Variable | Computed Value |
---|---|
| |
| |
| |
| |
| |
Props API#
- actions
node
DefaultnullOptional node to render on the top right of the card header, i.e. ActionRow or a DropdownMenu.
- className
string
DefaultnullThe class name for the CardHeader component
- title
node
DefaultnullThe title for the CardHeader component
- size
enum
'sm' | 'md'Default'md'The size of the CardHeader component
- subtitle
node
DefaultnullThe subtitle of the CardHeader component
- skeletonHeight
number
Default20Specifies height of skeleton in loading state.
- skeletonWidth
number
DefaultnullSpecifies width of skeleton in loading state.
- className
string
The class name for the CardGrid component
- children
node
RequiredThe Card components to organize into a responsive grid
- columnSizes
shape
{xs:number
,sm:number
,md:number
,lg:number
,xl:}number
,Default{ sm: 12, lg: 6, xl: 4, }An object containing the desired column size at each breakpoint, following a similar props API as
react-bootstrap/Col
- hasEqualColumnHeights
bool
DefaulttrueWhether to disable the default equal height cards across rows in the card grid
- className
string
Specifies class name to append to the base element.
- children
node
DefaultnullSpecifies contents of the component.
- title
node
Specifies title of the
Section
. - actions
node
Specifies node to render on the bottom right of the
Section
(i.e.ActionRow
). - muted
bool
DefaultfalseSpecifies whether to display
Section
with muted styling. - skeletonHeight
number
Default100Specifies height of skeleton in loading state.
- skeletonWidth
number
Specifies width of skeleton in loading state.
- className
string
Specifies class name to append to the base element.
- children
node
Specifies the content of the component.
- className
string
The class to append to the base element.
- className
string
Specifies class name to append to the base element.
- src
string
Specifies image src.
- fallbackSrc
string
DefaultcardSrcFallbackImgSpecifies fallback image src.
- srcAlt
string
Specifies image alt text.
- logoSrc
string
Specifies logo src to put on top of the image.
- fallbackLogoSrc
string
Specifies fallback image logo src.
- logoAlt
string
Specifies logo image alt text.
- skeletonHeight
number
Default140Specifies height of Image skeleton in loading state.
- skeletonWidth
number
Specifies width of Image skeleton in loading state.
- logoSkeleton
bool
DefaultfalseSpecifies whether the cap should be displayed during loading.
- logoSkeletonHeight
number
Default41Specifies height of Logo skeleton in loading state.
- logoSkeletonWidth
number
Specifies width of Logo skeleton in loading state.
- imageLoadingType
enum
'eager' | 'lazy'Default'eager'Specifies loading type for images
- children
node
RequiredSpecifies the content of the component.
- className
string
The class to append to the base element.
- icon
func
Icon that will be shown in the top-left corner.
- variant
enum
'primary' | 'success' | 'danger' | 'warning'Default'warning'Specifies variant to use.
- title
element
|string
Specifies title for the
Card.Status
. - actions
node
Specifies any optional actions, e.g. button(s).
- className
string
The class name for the CardDeck component
- children
node
RequiredThe Card components to organize
- columnSizes
shape
{xs:number
,sm:number
,md:number
,lg:number
,xl:}number
,Default{ sm: 12, lg: 6, xl: 4, }An object containing the desired column size at each breakpoint, following a similar props API as
react-bootstrap/Col
- hasInteractiveChildren
bool
DefaultfalseWhether the child
Card
components are interactive/focusable. If not, atabindex="0"
is added to be a11y-compliant - canScrollHorizontal
bool
DefaulttrueWhether the
CardDeck
supports horizontal scrolling when there are overflow children - hasOverflowScrollItems
bool
DefaultfalseWhether the children of CardDeck should be processed by
useOverflowScrollItems
to give each child a known/stable CSS classname - hasEqualColumnHeights
bool
DefaulttrueWhether to disable the default equal height cards
- children
node
RequiredThe
Card
items for theCardCarousel
. - ariaLabel
string
RequiredText describing the CardCarousel for screen readers
- title
node
An optional title.
- subtitle
node
An optional subtitle.
- columnSizes
shape
{xs:number
,sm:number
,md:number
,lg:number
,xl:}number
,Default{ sm: 12, lg: 6, xl: 4, }Customize the responsive columnSizes used by the carousel.
- hasInteractiveChildren
bool
DefaultfalseWhether the carousel has interactive children (e.g., clickable cards).
- canScrollHorizontal
bool
DefaulttrueWhether the carousel can be scrolled manually by users.
- disableOpacityMasks
bool
DefaultfalseWhether the default opacity masks should be shown at the start/end, if applicable.
- onScrollPrevious
func
Callback function for when the user scrolls to the previous element.
- onScrollNext
func
Callback function for when the user scrolls to the next element.
- CardCarouselControls
elementType
Optional override for the default
CardCarouselControls
Usage Insights#
Card
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 21.13.1 | 45 | |
frontend-app-authn | 22.11.2 | 1 | |
frontend-app-course-authoring | 22.8.1 | 33 | |
frontend-app-discussions | 22.7.0 | 1 | |
frontend-app-ecommerce | 20.46.3 | 1 | |
frontend-app-enterprise-public-catalog | 21.13.1 | 4 | |
frontend-app-learner-dashboard | 22.9.0 | 3 | |
frontend-app-learner-portal-enterprise | 21.13.1 | 30 | |
frontend-app-learning | 22.10.0 | 4 | |
frontend-app-library-authoring | 21.11.3 | 11 | |
frontend-app-ora-grading | 21.11.3 | 4 | |
frontend-app-support-tools | 21.13.1 | 7 | |
prospectus | 20.46.2 | 8 |
CardBody
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 21.13.1 | 6 | |
frontend-app-course-authoring | 22.8.1 | 15 | |
frontend-app-learner-dashboard | 22.9.0 | 2 | |
frontend-app-learner-portal-enterprise | 21.13.1 | 3 | |
frontend-app-library-authoring | 21.11.3 | 1 | |
prospectus | 20.46.2 | 2 |
CardCarousel
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-learner-portal-enterprise | 21.13.1 | 1 |
CardDeck
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-learner-portal-enterprise | 21.13.1 | 1 |
CardDivider
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-course-authoring | 22.8.1 | 9 | |
prospectus | 20.46.2 | 1 |
CardFooter
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 21.13.1 | 16 | |
frontend-app-course-authoring | 22.8.1 | 13 | |
frontend-app-learner-dashboard | 22.9.0 | 1 | |
frontend-app-learner-portal-enterprise | 21.13.1 | 7 | |
frontend-app-learning | 22.10.0 | 3 | |
frontend-app-library-authoring | 21.11.3 | 3 | |
frontend-app-ora-grading | 21.11.3 | 1 | |
frontend-app-support-tools | 21.13.1 | 2 |
CardGrid
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 21.13.1 | 12 | |
frontend-app-course-authoring | 22.8.1 | 2 | |
frontend-app-learner-portal-enterprise | 21.13.1 | 18 | |
prospectus | 20.46.2 | 3 |
CardHeader
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 21.13.1 | 10 | |
frontend-app-authn | 22.11.2 | 1 | |
frontend-app-course-authoring | 22.8.1 | 16 | |
frontend-app-enterprise-public-catalog | 21.13.1 | 2 | |
frontend-app-learner-dashboard | 22.9.0 | 2 | |
frontend-app-learner-portal-enterprise | 21.13.1 | 22 | |
frontend-app-learning | 22.10.0 | 4 | |
frontend-app-library-authoring | 21.11.3 | 5 | |
frontend-app-support-tools | 21.13.1 | 5 |
CardImageCap
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 21.13.1 | 10 | |
frontend-app-authn | 22.11.2 | 1 | |
frontend-app-enterprise-public-catalog | 21.13.1 | 2 | |
frontend-app-learner-dashboard | 22.9.0 | 2 | |
frontend-app-learner-portal-enterprise | 21.13.1 | 11 | |
frontend-app-learning | 22.10.0 | 1 |
CardSection
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 21.13.1 | 40 | |
frontend-app-authn | 22.11.2 | 1 | |
frontend-app-course-authoring | 22.8.1 | 27 | |
frontend-app-discussions | 22.7.0 | 1 | |
frontend-app-enterprise-public-catalog | 21.13.1 | 9 | |
frontend-app-learner-dashboard | 22.9.0 | 1 | |
frontend-app-learner-portal-enterprise | 21.13.1 | 46 | |
frontend-app-learning | 22.10.0 | 4 | |
frontend-app-library-authoring | 21.11.3 | 8 | |
frontend-app-ora-grading | 21.11.3 | 2 | |
frontend-app-support-tools | 21.13.1 | 10 | |
prospectus | 20.46.2 | 3 |
CardStatus
Project Name | Paragon Version | Instance Count | |
---|---|---|---|
frontend-app-admin-portal | 21.13.1 | 2 | |
frontend-app-course-authoring | 22.8.1 | 1 | |
frontend-app-learner-portal-enterprise | 21.13.1 | 2 |