Infragistics
Close
Angular React Web Components Blazor React
Open Source

Card

The Ignite UI for React Card organizes related media, text, and actions in one flexible content container.

Use the card to group content about a single subject, such as a product, article, contact, location, or dashboard item.

Live Demo

Anatomy

The card is a container whose standard building blocks are header, media, content, and actions.

React Card anatomy: header, media, content, and actions regions
A - Media Container1. Image (optional)
B - Card Header2. Title3. Avatar (optional)4. Subtitle
C - Content area5. Paragraph
D - Card Footer6. Action Buttons, Icon Buttons
igc-card                         // host - groups related content
├─ igc-card-media                 // optional media region
│  └─ default slot                // image, video, or other media content
├─ igc-card-header                // optional header region
│  ├─ [slot="thumbnail"]          // optional avatar, icon, or small image
│  ├─ [slot="title"]              // card title
│  ├─ [slot="subtitle"]           // optional card subtitle
│  └─ default slot                // optional additional header content
├─ igc-card-content               // optional body region
│  └─ default slot                // text, lists, or custom content
└─ igc-card-actions               // optional action region
   ├─ [slot="start"]              // leading actions
   ├─ default slot                // centered actions
   └─ [slot="end"]                // trailing actions

Getting Started

To use the React Card, follow the Ignite UI for React Getting Started topic for the basic project setup, then register the component for your target platform.

For React using the igniteui-react package, install the package:

npm install igniteui-react

You will then need to import the Card wrappers and the theme CSS, like so:

import {
  IgrCard,
  IgrCardActions,
  IgrCardContent,
  IgrCardHeader,
  IgrCardMedia,
} from 'igniteui-react';
import 'igniteui-webcomponents/themes/light/bootstrap.css';

Import any other wrappers your card content uses, such as IgrAvatar, IgrButton, and IgrIconButton.

The simplest way to start using the IgrCard is as follows:

<IgrCard>
  <IgrCardHeader>
    <h3 slot="title">Title</h3>
  </IgrCardHeader>
  <IgrCardContent>
    <p>Content</p>
  </IgrCardContent>
</IgrCard>

Usage

Compose a card from the card container and whichever sub-components your content needs.

Media

Use IgrCardMedia to place images, video, or other media content in the card.

<IgrCardMedia>
  <img src="https://images.unsplash.com/photo-1518235506717-e1ed3306a89b?ixlib=rb-1.2.1&auto=format&fit=crop&w=640&q=50" alt="New York city skyline" />
</IgrCardMedia>

Position

Place the media above or below the header. The card renders its regions in the order you add them, so the element order in your markup sets the media position.

Header Slots

Use the header slots to define thumbnail, title, subtitle, and additional header content.

<IgrCardHeader>
  <IgrAvatar slot="thumbnail" initials="TS" />
  <h3 slot="title">Title</h3>
  <span slot="subtitle">Subtitle</span>
</IgrCardHeader>

Pass a heading element, such as <h3>, to the title slot so the card takes its place in the document outline, and use a neutral inline element such as <span> for the subtitle. The header resets the margin and font of slotted content, so the heading keeps the card typography.

Content

Use IgrCardContent for the card body text, lists, or custom content.

<IgrCardContent>
  <p>New York City comprises five boroughs where the Hudson River meets the Atlantic Ocean.</p>
</IgrCardContent>

Elevated

Set elevated when the card should use the elevated visual treatment.

<IgrCard elevated={true}>
  ...
</IgrCard>

Actions Slots

Use the actions slots to place leading, centered, and trailing actions in IgrCardActions.

<IgrCardActions>
  <IgrButton slot="start">Like</IgrButton>
  <IgrButton>Comment</IgrButton>
  <IgrIconButton slot="end" name="more_vert" />
</IgrCardActions>

Actions Orientation

Use the orientation property to arrange IgrCardActions content horizontally or vertically. The actions are horizontal by default, so set orientation to vertical to stack them.

<IgrCardActions orientation="vertical">
  <IgrButton slot="start">Like</IgrButton>
  <IgrButton slot="start">Share</IgrButton>
  <IgrIconButton slot="end" name="more_vert" />
</IgrCardActions>

Layout

Use layout wrappers when card sections need to be arranged horizontally or split between media and content areas.

For a horizontal card, group the header and content in one wrapper, add the actions beside that wrapper, and apply a flex row to the card content.

<IgrCard>
  <div className="card-horizontal">
    <div>
      <IgrCardHeader>
        <img src="https://dl.infragistics.com/x/img/music/rozes.jpg" slot="thumbnail" alt="Rozes album cover" />
        <span slot="title">Rozes</span>
        <span slot="subtitle">Under the Grave (2016)</span>
      </IgrCardHeader>
      <IgrCardContent>
        <p>As I have always said: I write what's real and what's true, even if it means throwing myself under the bus.</p>
      </IgrCardContent>
    </div>
    <div className="divider"></div>
    <IgrCardActions>
      <IgrIconButton variant="flat" name="skip_previous" aria-label="Previous track" />
      <IgrIconButton variant="flat" name="play_arrow" aria-label="Play" />
      <IgrIconButton variant="flat" name="skip_next" aria-label="Next track" />
    </IgrCardActions>
  </div>
</IgrCard>
.card-horizontal {
  display: flex;
  flex-direction: row;
  flex: 1 1 0%;
}

.card-horizontal igc-card-actions {
  justify-content: center;
}

For a semi-horizontal card, keep the header, content, and actions stacked in one column, then place the media section beside that column.

<IgrCard>
  <div className="semi-horizontal">
    <div>
      <IgrCardHeader>
        <IgrAvatar src="https://dl.infragistics.com/x/img/music/singer_with_mic.jpg" slot="thumbnail" />
        <span slot="title">HERE</span>
        <span slot="subtitle">by Mellow D</span>
      </IgrCardHeader>
      <IgrCardContent>
        <p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
      </IgrCardContent>
      <IgrCardActions>
        <IgrButton>Play Album</IgrButton>
      </IgrCardActions>
    </div>
    <IgrCardMedia className="card-media">
      <img src="https://dl.infragistics.com/x/img/music/singer_female.jpg" alt="Singer" />
    </IgrCardMedia>
  </div>
</IgrCard>
.semi-horizontal {
  display: flex;
  flex-direction: row;
  flex-grow: 1;
}

.card-media {
  width: 96px;
  min-width: 96px;
}

Do/Don’t

The card usually works as an overview UI and an entry point for more detailed information. Avoid clogging it with too much information, and as you create dashboards with it, size and arrange the cards consistently in order to form a layout grid with equal horizontal and vertical gaps between cards.

React Card do guidance: a short summary in the card content with one action
DoKeep body text brief and focused on essential information for quick readability.
React Card don't guidance: long-form text filling the card content
Don’tAvoid overloading the card body with long paragraphs or unnecessary detail.

Properties

The card API exposes container appearance and action-layout controls.

Name Type Default Description
elevated boolean false Sets the card to use an elevated appearance with shadow.
orientation "horizontal" | "vertical" "horizontal" Sets the layout orientation of IgrCardActions.

Styling

The card appearance is controlled through theme variables.

Variable What it changes
--ig-card-background Card background color.
--ig-card-outline-color Card outline color.
--ig-card-header-text-color Card title text color.
--ig-card-subtitle-text-color Card subtitle text color.
--ig-card-content-text-color Card content text color.
--ig-card-actions-text-color Card actions text color.
--ig-card-resting-shadow Card shadow in its resting state.
--ig-card-hover-shadow Card shadow in its hover state.
--ig-card-border-radius Card border radius.

The card header also exposes CSS parts for its text containers.

CSS Part Description
header Card header text container.
title Title slot wrapper.
subtitle Subtitle slot wrapper.

Sass Theming

Use the card-theme function when your application customizes Ignite UI themes through Sass.

@use "igniteui-theming/sass/themes" as *;

$custom-card-theme: card-theme(
  $background: #1f2937,
  $border-radius: 12px,
  $header-text-color: #ffffff,
  $content-text-color: #e5e7eb
);

:root {
  @include tokens($custom-card-theme);
}

CSS Variables

Set component CSS variables directly when you need local styling without a Sass build step.

igc-card {
  --ig-card-background: var(--ig-secondary-900);
  --ig-card-header-text-color: var(--ig-secondary-900-contrast);
  --ig-card-content-text-color: var(--ig-secondary-900-contrast);
}

igc-card-header::part(subtitle) {
  color: var(--ig-warn-500);
}

Styling with Tailwind

Use Tailwind utility classes when your application already uses Tailwind and you want the card layout and local color choices to stay in the component markup.

Accessibility

The card is a container. Grouping and media semantics come from the card regions, while keyboard operability and accessible names come from the content you place inside them.

Keyboard Interaction

The card and its header, media, content, and actions regions declare no key handlers and are not in the tab order. Focus moves through the focusable content you place inside them, in DOM order.

Key Action
Tab Moves focus to the next focusable element inside the card, such as a button or link in the content or actions area.
Shift + Tab Moves focus to the previous focusable element inside the card.

The actions area always renders its leading region, then its centered content, then its trailing region. Switching the actions to a vertical layout restyles them without reordering the DOM, so keyboard and screen reader order stay the same.

Screen Readers / ARIA

  • The card and every card region render plain slots and set no role or aria-* attributes. The wrapper elements inside the header have no accessible name and create no landmarks. Add a role and an accessible name on the card host yourself when your information architecture needs one.
  • The title and subtitle slots render whatever element you pass and do not impose a heading level.
  • Add alt text to images in the media region.
  • Give icon-only buttons in the actions area an accessible name; the icon alone provides none.
  • Use a single interactive element when the whole card triggers one action, rather than attaching a click handler to the container, so the action keeps a role and a name.

Accessibility Compliance

Infragistics documents Ignite UI for React accessibility support for Section 508 and WCAG 2.1 guideline areas in the Accessibility Compliance topic.

Criterion How the component complies
1.3.1 Info and Relationships The card regions project slotted content without rewriting it, so headings, text, lists, media, and controls keep their native semantics.
2.1.1 Keyboard The card adds no key handling and no focus traps of its own, so keyboard-operable content inside it stays operable.
2.4.3 Focus Order The actions area renders its start slot, default slot, and end slot in a fixed DOM order that the vertical orientation does not change.
4.1.2 Name, Role, Value The card sets no implicit role, which leaves the name, role, and value of every control to the content you supply.

Your responsibilities:

  • Pass a real heading element to the title so the card takes its place in the document outline, and keep the subtitle as plain text.
  • Provide alternative text for meaningful media, and give the media region an accessible name wherever it is exposed as an image.
  • Give icon-only action buttons an accessible name.
  • Keep DOM order and visual order aligned when you build horizontal or split card layouts with CSS.
  • Keep sufficient contrast when overriding card colors.

API References

Dependencies

The card uses its own header, media, content, and actions sub-components. Cards that include thumbnails, actions, icons, or ripples also depend on the corresponding IgrAvatar, IgrButton, IgrIconButton, IgrIcon, and IgrRipple components.

Import the card wrappers and any supporting wrappers that your card content uses. Include a Ignite UI for React theme stylesheet once in your application.

Additional Resources

Use these resources to continue with Ignite UI for React Card support, source, and related layout guidance.

Use the Grid when users need dense tabular data with sorting, filtering, and column-level interaction. Use the List when repeated items should remain compact and primarily vertical.

FAQ

How do I make an entire card clickable without breaking screen readers?

The card is a plain container and adds no interactive behavior, so wrapping the whole card in a link is a common but harmful shortcut: the accessible name of that link becomes every piece of text in the card. Put a real link or button on the card title instead, then stretch it over the card with an absolutely positioned pseudo-element that covers the card box. The title stays the accessible name, the whole rectangle stays clickable, and text selection and middle-click keep working.

How do I make cards in a row or grid the same height?

The card sizes itself from its content and does not equalize heights across siblings. Lay the cards out in a CSS grid or a flex row so each card stretches to the row height, give the media region a fixed height or aspect-ratio, and clamp the title and body to a set number of lines with -webkit-line-clamp. Unequal card heights almost always come from letting each image and each paragraph decide its own height.

Why is my card image cropped, and how do I control its size?

The card media region stretches its content to the full width and height of the region and applies object-fit: cover, so the image is cropped rather than distorted. Size the media region itself with CSS height or aspect-ratio; changing the dimensions of the image inside has no effect.

Why do my card actions appear in a different region than the one I placed them in?

Content in the end slot of the card actions takes an automatic leading margin so it aligns with the opposite edge of the actions area, which makes a single trailing action look detached from the rest. Move the element to the start slot or to the default slot when it belongs with the other actions. The three regions always render in start, default, end order regardless of the orientation.

When should I use Grid or List instead of Card?

Use Grid when the data is dense and tabular and readers need to scan, sort, or compare across columns, and use List when many short, uniform rows must fit in a small space. Use Card when each item deserves its own media, longer text, and its own actions. A long scroll of cards is usually a list in disguise.