Theme

npm_versionnpm Paragon package page

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.

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.

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.

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.

Any Paragon component or export may be added to the code example.

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 VariableComputed Value










Props API#

Card Props API
This component does not receive any props.
CardHeader Props API
  • actions node

    Optional node to render on the top right of the card header, i.e. ActionRow or a DropdownMenu.

    Defaultnull
  • className string

    The class name for the CardHeader component

    Defaultnull
  • title node

    The title for the CardHeader component

    Defaultnull
  • size enum'sm' | 'md'

    The size of the CardHeader component

    Default'md'
  • subtitle node

    The subtitle of the CardHeader component

    Defaultnull
  • skeletonHeight number

    Specifies height of skeleton in loading state.

    Default20
  • skeletonWidth number

    Specifies width of skeleton in loading state.

    Defaultnull
CardGrid Props API
  • className string

    The class name for the CardGrid component

  • children node Required

    The Card components to organize into a responsive grid

  • columnSizes shape {
    xs: number,
    sm: number,
    md: number,
    lg: number,
    xl: number,
    }

    An object containing the desired column size at each breakpoint, following a similar props API as react-bootstrap/Col

    Default{ sm: 12, lg: 6, xl: 4, }
  • hasEqualColumnHeights bool

    Whether to disable the default equal height cards across rows in the card grid

    Defaulttrue
CardSection Props API
  • className string

    Specifies class name to append to the base element.

  • children node

    Specifies contents of the component.

    Defaultnull
  • 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

    Specifies whether to display Section with muted styling.

    Defaultfalse
  • skeletonHeight number

    Specifies height of skeleton in loading state.

    Default100
  • skeletonWidth number

    Specifies width of skeleton in loading state.

CardDivider Props API
  • className string

    Specifies class name to append to the base element.

CardFooter Props API
  • children node

    Specifies contents of the component.

    Defaultnull
  • className string

    Specifies class name to append to the base element.

  • textElement node

    Optional node to display near actions. Should be either a plain text or an element containing text (e.g. link).

  • isStacked bool

    Specifies whether to use stacked variant.

    Defaultfalse
  • orientation enum'horizontal' | 'vertical'

    Specifies which orientation to use. This prop will override context value if provided.

  • skeletonHeight number

    Specifies height of skeleton in loading state.

    Default18
  • skeletonWidth number

    Specifies width of skeleton in loading state.

CardBody Props API
  • children node

    Specifies the content of the component.

  • className string

    The class to append to the base element.

CardImageCap Props API
  • className string

    Specifies class name to append to the base element.

  • src string

    Specifies image src.

  • fallbackSrc string

    Specifies fallback image src.

    DefaultcardSrcFallbackImg
  • 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

    Specifies height of Image skeleton in loading state.

    Default140
  • skeletonWidth number

    Specifies width of Image skeleton in loading state.

  • logoSkeleton bool

    Specifies whether the cap should be displayed during loading.

    Defaultfalse
  • logoSkeletonHeight number

    Specifies height of Logo skeleton in loading state.

    Default41
  • logoSkeletonWidth number

    Specifies width of Logo skeleton in loading state.

  • imageLoadingType enum'eager' | 'lazy'

    Specifies loading type for images

    Default'eager'
CardStatus Props API
  • children node Required

    Specifies 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'

    Specifies variant to use.

    Default'warning'
  • title element | string

    Specifies title for the Card.Status.

  • actions node

    Specifies any optional actions, e.g. button(s).

CardDeck Props API
  • className string

    The class name for the CardDeck component

  • children node Required

    The Card components to organize

  • columnSizes shape {
    xs: number,
    sm: number,
    md: number,
    lg: number,
    xl: number,
    }

    An object containing the desired column size at each breakpoint, following a similar props API as react-bootstrap/Col

    Default{ sm: 12, lg: 6, xl: 4, }
  • hasInteractiveChildren bool

    Whether the child Card components are interactive/focusable. If not, a tabindex="0" is added to be a11y-compliant

    Defaultfalse
  • canScrollHorizontal bool

    Whether the CardDeck supports horizontal scrolling when there are overflow children

    Defaulttrue
  • hasOverflowScrollItems bool

    Whether the children of CardDeck should be processed by useOverflowScrollItems to give each child a known/stable CSS classname

    Defaultfalse
  • hasEqualColumnHeights bool

    Whether to disable the default equal height cards

    Defaulttrue
CardCarousel Props API
  • children node Required

    The Card items for the CardCarousel.

  • ariaLabel string Required

    Text 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,
    }

    Customize the responsive columnSizes used by the carousel.

    Default{ sm: 12, lg: 6, xl: 4, }
  • hasInteractiveChildren bool

    Whether the carousel has interactive children (e.g., clickable cards).

    Defaultfalse
  • canScrollHorizontal bool

    Whether the carousel can be scrolled manually by users.

    Defaulttrue
  • disableOpacityMasks bool

    Whether the default opacity masks should be shown at the start/end, if applicable.

    Defaultfalse
  • 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 NameParagon VersionInstance Count
frontend-app-admin-portal21.13.145
frontend-app-authn22.11.21
frontend-app-course-authoring22.8.133
frontend-app-discussions22.7.01
frontend-app-ecommerce20.46.31
frontend-app-enterprise-public-catalog21.13.14
frontend-app-learner-dashboard22.9.03
frontend-app-learner-portal-enterprise21.13.130
frontend-app-learning22.10.04
frontend-app-library-authoring21.11.311
frontend-app-ora-grading21.11.34
frontend-app-support-tools21.13.17
prospectus20.46.28

CardBody

Project NameParagon VersionInstance Count
frontend-app-admin-portal21.13.16
frontend-app-course-authoring22.8.115
frontend-app-learner-dashboard22.9.02
frontend-app-learner-portal-enterprise21.13.13
frontend-app-library-authoring21.11.31
prospectus20.46.22

CardCarousel

Project NameParagon VersionInstance Count
frontend-app-learner-portal-enterprise21.13.11

CardDeck

Project NameParagon VersionInstance Count
frontend-app-learner-portal-enterprise21.13.11

CardDivider

Project NameParagon VersionInstance Count
frontend-app-course-authoring22.8.19
prospectus20.46.21

CardFooter

Project NameParagon VersionInstance Count
frontend-app-admin-portal21.13.116
frontend-app-course-authoring22.8.113
frontend-app-learner-dashboard22.9.01
frontend-app-learner-portal-enterprise21.13.17
frontend-app-learning22.10.03
frontend-app-library-authoring21.11.33
frontend-app-ora-grading21.11.31
frontend-app-support-tools21.13.12

CardGrid

Project NameParagon VersionInstance Count
frontend-app-admin-portal21.13.112
frontend-app-course-authoring22.8.12
frontend-app-learner-portal-enterprise21.13.118
prospectus20.46.23

CardHeader

Project NameParagon VersionInstance Count
frontend-app-admin-portal21.13.110
frontend-app-authn22.11.21
frontend-app-course-authoring22.8.116
frontend-app-enterprise-public-catalog21.13.12
frontend-app-learner-dashboard22.9.02
frontend-app-learner-portal-enterprise21.13.122
frontend-app-learning22.10.04
frontend-app-library-authoring21.11.35
frontend-app-support-tools21.13.15

CardImageCap

Project NameParagon VersionInstance Count
frontend-app-admin-portal21.13.110
frontend-app-authn22.11.21
frontend-app-enterprise-public-catalog21.13.12
frontend-app-learner-dashboard22.9.02
frontend-app-learner-portal-enterprise21.13.111
frontend-app-learning22.10.01

CardSection

Project NameParagon VersionInstance Count
frontend-app-admin-portal21.13.140
frontend-app-authn22.11.21
frontend-app-course-authoring22.8.127
frontend-app-discussions22.7.01
frontend-app-enterprise-public-catalog21.13.19
frontend-app-learner-dashboard22.9.01
frontend-app-learner-portal-enterprise21.13.146
frontend-app-learning22.10.04
frontend-app-library-authoring21.11.38
frontend-app-ora-grading21.11.32
frontend-app-support-tools21.13.110
prospectus20.46.23

CardStatus

Project NameParagon VersionInstance Count
frontend-app-admin-portal21.13.12
frontend-app-course-authoring22.8.11
frontend-app-learner-portal-enterprise21.13.12