Angular Card Component

Card

Angular Card component provides a flexible and extensible container for displaying content. Card is delivered with a bunch of variants and options.

Available in Other JavaScript Frameworks

CoreUI Angular Card Component is also available for Bootstrap, React, and Vue. Explore framework-specific implementations below:

Use CoreUI Angular card component provides a flexible and extensible container for displaying content. Card is delivered with a bunch of variants and options.

About

Angular card component is a content container. It incorporates options for images, headers, and footers, a wide variety of content, contextual background colors, and excellent display options. Cards are built with as little markup and styles as possible but still manage to deliver a bunch of control and customization. Built with flexbox, they offer easy alignment and mix well with other CoreUI components. Cards have no top, left, and right margins by default, so use spacing utilities as needed. They have no fixed width to start, so they’ll fill the full width of its parent.

Examples

Base card

import { Component } from '@angular/core';
import {
  ButtonDirective,
  CardBodyComponent,
  CardComponent,
  CardImgDirective,
  CardTextDirective,
  CardTitleDirective
} from '@coreui/angular';

@Component({
  selector: 'docs-card-base',
  templateUrl: './card-base.component.html',
  styleUrls: ['./card-base.component.scss'],
  imports: [CardComponent, CardImgDirective, CardBodyComponent, CardTitleDirective, CardTextDirective, ButtonDirective]
})
export class CardBaseComponent {}
<c-card>
  <img cCardImg="top" src="/assets/img/angular.jpg">
  <c-card-body>
    <h5 cCardTitle>Card title</h5>
    <p cCardText>
      Some quick example text to build on the card title and make up the bulk of the card's content.
    </p>
    <button cButton color="light">Go somewhere</button>
  </c-card-body>
</c-card>
:host {
  c-card {
    min-width: 9rem;
    .list-group {
      max-width: 100%;
    }
  }
}

Content types

CoreUI card supports a wide variety of content, including images, text, list groups, links, and more. Below are examples of those elements.

Body

The main block of a card is the c-card-body. Use it whenever you need a padded section within a card.

import { Component } from '@angular/core';
import { CardBodyComponent, CardComponent } from '@coreui/angular';

@Component({
  selector: 'docs-card-body-example',
  templateUrl: './card-body-example.component.html',
  imports: [CardComponent, CardBodyComponent]
})
export class CardBodyExampleComponent {}
<c-card>
  <c-card-body>This is some text within a card body.</c-card-body>
</c-card>

Card titles are managed by cCardTitle directive. Identically, links are attached and collected next to each other by cCardLink directive. Subtitles are managed by cCardSubtitle directive. Also, if the cCardTitle and cCardSubtitle items are stored in a c-card-body item, the card title, and subtitle are arranged rightly.

import { Component } from '@angular/core';
import { RouterLink } from '@angular/router';
import {
  CardBodyComponent,
  CardComponent,
  CardLinkDirective,
  CardSubtitleDirective,
  CardTextDirective,
  CardTitleDirective
} from '@coreui/angular';

@Component({
  selector: 'docs-card-titles-links',
  templateUrl: './card-titles-links.component.html',
  styleUrls: ['./card-base.component.scss'],
  imports: [
    CardComponent,
    CardBodyComponent,
    CardTitleDirective,
    CardSubtitleDirective,
    CardTextDirective,
    CardLinkDirective,
    RouterLink
  ]
})
export class CardTitlesLinksComponent {}
<c-card>
  <c-card-body>
    <h5 cCardTitle>Card title</h5>
    <h6 cCardSubtitle class="mb-2 text-medium-emphasis">
      Card subtitle
    </h6>
    <p cCardText>
      Some quick example text to build on the card title and make up the
      bulk of the card content.
    </p>
    <a [routerLink] cCardLink>Card link</a>
    <a [routerLink] cCardLink>Another link</a>
  </c-card-body>
</c-card>
:host {
  c-card {
    min-width: 9rem;
    .list-group {
      max-width: 100%;
    }
  }
}

Images and text

cCardImg="top" places a picture at the top of the card. With cCardText, text can be added to the card. Text within cCardText can additionally be styled with the regular HTML tags.

import { Component } from '@angular/core';
import { CardBodyComponent, CardComponent, CardImgDirective, CardTextDirective } from '@coreui/angular';

@Component({
  selector: 'docs-card-images-text',
  templateUrl: './card-images-text.component.html',
  styleUrls: ['./card-base.component.scss'],
  imports: [CardComponent, CardImgDirective, CardBodyComponent, CardTextDirective]
})
export class CardImagesTextComponent {}
<c-card>
  <img cCardImg="top" src="/assets/img/angular.jpg">
  <c-card-body>
    <p cCardText>
      Some quick example <strong>text</strong> to build on the card title and make up the bulk of the card's content.
    </p>
  </c-card-body>
</c-card>
:host {
  c-card {
    min-width: 9rem;
    .list-group {
      max-width: 100%;
    }
  }
}

List groups

Create lists of content in a card with a flush list group.

import { Component } from '@angular/core';
import { CardComponent, ListGroupDirective, ListGroupItemDirective } from '@coreui/angular';

@Component({
  selector: 'docs-card-list-groups',
  templateUrl: './card-list-groups.component.html',
  styleUrls: ['./card-base.component.scss'],
  imports: [CardComponent, ListGroupDirective, ListGroupItemDirective]
})
export class CardListGroupsComponent {}
<c-card>
  <ul cListGroup [flush]="true">
    <li cListGroupItem>Cras justo odio</li>
    <li cListGroupItem>Dapibus ac facilisis in</li>
    <li cListGroupItem>Vestibulum at eros</li>
  </ul>
</c-card>
:host {
  c-card {
    min-width: 9rem;
    .list-group {
      max-width: 100%;
    }
  }
}
import { Component } from '@angular/core';
import { CardComponent, CardHeaderComponent, ListGroupDirective, ListGroupItemDirective } from '@coreui/angular';

@Component({
  selector: 'docs-card-list-groups-2',
  templateUrl: './card-list-groups-2.component.html',
  styleUrls: ['./card-base.component.scss'],
  imports: [CardComponent, CardHeaderComponent, ListGroupDirective, ListGroupItemDirective]
})
export class CardListGroups2Component {}
<c-card>
  <c-card-header>Header</c-card-header>
  <ul cListGroup [flush]="true">
    <li cListGroupItem>Cras justo odio</li>
    <li cListGroupItem>Dapibus ac facilisis in</li>
    <li cListGroupItem>Vestibulum at eros</li>
  </ul>
</c-card>
:host {
  c-card {
    min-width: 9rem;
    .list-group {
      max-width: 100%;
    }
  }
}
import { Component } from '@angular/core';
import { CardComponent, CardFooterComponent, ListGroupDirective, ListGroupItemDirective } from '@coreui/angular';

@Component({
  selector: 'docs-card-list-groups-3',
  templateUrl: './card-list-groups-3.component.html',
  styleUrls: ['./card-base.component.scss'],
  imports: [CardComponent, ListGroupDirective, ListGroupItemDirective, CardFooterComponent]
})
export class CardListGroups3Component {}
<c-card>
  <ul cListGroup [flush]="true">
    <li cListGroupItem>Cras justo odio</li>
    <li cListGroupItem>Dapibus ac facilisis in</li>
    <li cListGroupItem>Vestibulum at eros</li>
  </ul>
  <c-card-footer>Footer</c-card-footer>
</c-card>
:host {
  c-card {
    min-width: 9rem;
    .list-group {
      max-width: 100%;
    }
  }
}

Kitchen sink

Combine and match many content types to build the card you need, or throw everything in there. Shown below are image styles, blocks, text styles, and a list group—all wrapped in a fixed-width card.

import { Component } from '@angular/core';
import { RouterLink } from '@angular/router';
import {
  CardBodyComponent,
  CardComponent,
  CardImgDirective,
  CardLinkDirective,
  CardTextDirective,
  CardTitleDirective,
  ListGroupDirective,
  ListGroupItemDirective
} from '@coreui/angular';

@Component({
  selector: 'docs-card-kitchen-sink',
  templateUrl: './card-kitchen-sink.component.html',
  styleUrls: ['./card-base.component.scss'],
  imports: [
    CardComponent,
    CardImgDirective,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective,
    ListGroupDirective,
    ListGroupItemDirective,
    CardLinkDirective,
    RouterLink
  ]
})
export class CardKitchenSinkComponent {}
<c-card style="width: 18rem;">
  <img cCardImg="top" src="/assets/img/angular.jpg">
  <c-card-body>
    <h5 cCardTitle>Card title</h5>
    <p cCardText>
      Some quick example text to build on the card title and make up the
      bulk of the card content.
    </p>
  </c-card-body>
  <ul cListGroup [flush]="true">
    <li cListGroupItem>Cras justo odio</li>
    <li cListGroupItem>Dapibus ac facilisis in</li>
    <li cListGroupItem>Vestibulum at eros</li>
  </ul>
  <c-card-body>
    <a cCardLink [routerLink]>Card link</a>
    <a cCardLink [routerLink]>Another link</a>
  </c-card-body>
</c-card>
:host {
  c-card {
    min-width: 9rem;
    .list-group {
      max-width: 100%;
    }
  }
}

Add an optional header and/or footer within a card.

import { Component } from '@angular/core';
import {
  ButtonDirective,
  CardBodyComponent,
  CardComponent,
  CardHeaderComponent,
  CardTextDirective,
  CardTitleDirective
} from '@coreui/angular';

@Component({
  selector: 'docs-card-header-footer',
  templateUrl: './card-header-footer.component.html',
  styleUrls: ['./card-base.component.scss'],
  imports: [
    CardComponent,
    CardHeaderComponent,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective,
    ButtonDirective
  ]
})
export class CardHeaderFooterComponent {}
<c-card>
  <c-card-header>Header</c-card-header>
  <c-card-body>
    <h5 cCardTitle>Special title treatment</h5>
    <p cCardText>With supporting text below as a natural lead-in to additional content.</p>
    <button cButton>Go somewhere</button>
  </c-card-body>
</c-card>
:host {
  c-card {
    min-width: 9rem;
    .list-group {
      max-width: 100%;
    }
  }
}

Card headers can be styled with html.

import { Component } from '@angular/core';
import {
  ButtonDirective,
  CardBodyComponent,
  CardComponent,
  CardHeaderComponent,
  CardTextDirective,
  CardTitleDirective
} from '@coreui/angular';

@Component({
  selector: 'docs-card-header-footer-2',
  templateUrl: './card-header-footer-2.component.html',
  styleUrls: ['./card-base.component.scss'],
  imports: [
    CardComponent,
    CardHeaderComponent,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective,
    ButtonDirective
  ]
})
export class CardHeaderFooter2Component {}
<c-card>
  <c-card-header>
    <h5>Header</h5>
  </c-card-header>
  <c-card-body>
    <h5 cCardTitle>Special title treatment</h5>
    <p cCardText>With supporting text below as a natural lead-in to additional content.</p>
    <button cButton>Go somewhere</button>
  </c-card-body>
</c-card>
:host {
  c-card {
    min-width: 9rem;
    .list-group {
      max-width: 100%;
    }
  }
}
import { Component } from '@angular/core';
import { CardBodyComponent, CardComponent, CardHeaderComponent } from '@coreui/angular';

@Component({
  selector: 'docs-card-header-footer-3',
  templateUrl: './card-header-footer-3.component.html',
  imports: [CardComponent, CardHeaderComponent, CardBodyComponent]
})
export class CardHeaderFooter3Component {}
<c-card>
  <c-card-header>Quote</c-card-header>
  <c-card-body>
    <blockquote class="blockquote mb-0">
      <p>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit.
        Integer posuere erat a ante.
      </p>
      <footer class="blockquote-footer">
        Someone famous in
        <cite title="Source Title">Source Title</cite>
      </footer>
    </blockquote>
  </c-card-body>
</c-card>
import { Component } from '@angular/core';
import {
  ButtonDirective,
  CardBodyComponent,
  CardComponent,
  CardFooterComponent,
  CardHeaderComponent,
  CardTextDirective,
  CardTitleDirective
} from '@coreui/angular';

@Component({
  selector: 'docs-card-header-footer-4',
  templateUrl: './card-header-footer-4.component.html',
  imports: [
    CardComponent,
    CardHeaderComponent,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective,
    ButtonDirective,
    CardFooterComponent
  ]
})
export class CardHeaderFooter4Component {}
<c-card class="text-center mb-4">
  <c-card-header>Header</c-card-header>
  <c-card-body>
    <h5 cCardTitle>Card title</h5>
    <p cCardText>
      Some quick example text to build on the card title and make up the bulk of the card's content.
    </p>
    <button cButton color="primary">Go somewhere</button>
  </c-card-body>
  <c-card-footer class="text-medium-emphasis">
    2 days ago
  </c-card-footer>
</c-card>

Sizing

Cards assume no specific width to start, so they’ll be 100% wide unless otherwise stated. You can adjust this as required with custom CSS, grid classes, grid Sass mixins, or services.

Using grid markup

Using the grid, wrap cards in columns and rows as needed.

import { Component } from '@angular/core';
import {
  ButtonDirective,
  CardBodyComponent,
  CardComponent,
  CardTextDirective,
  CardTitleDirective,
  ColComponent,
  RowComponent
} from '@coreui/angular';

@Component({
  selector: 'docs-card-grid-markup',
  templateUrl: './card-grid-markup.component.html',
  imports: [
    RowComponent,
    ColComponent,
    CardComponent,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective,
    ButtonDirective
  ]
})
export class CardGridMarkupComponent {}
<c-row>
  <c-col [sm]="6">
    <c-card class="mb-4">
      <c-card-body>
        <h5 cCardTitle>Card title</h5>
        <p cCardText>
          Some quick example text to build on the card title and make up the bulk of the card's content.
        </p>
        <button cButton color="primary">Go somewhere</button>
      </c-card-body>
    </c-card>
  </c-col>
  <c-col [sm]="6">
    <c-card class="mb-4">
      <c-card-body>
        <h5 cCardTitle>Card title</h5>
        <p cCardText>
          Some quick example text to build on the card title and make up the bulk of the card's content.
        </p>
        <button cButton color="primary">Go somewhere</button>
      </c-card-body>
    </c-card>
  </c-col>
</c-row>

Using utilities

Use some of available sizing utilities to rapidly set a card width.

import { Component } from '@angular/core';
import {
  ButtonDirective,
  CardBodyComponent,
  CardComponent,
  CardTextDirective,
  CardTitleDirective
} from '@coreui/angular';

@Component({
  selector: 'docs-card-utilities',
  templateUrl: './card-utilities.component.html',
  imports: [CardComponent, CardBodyComponent, CardTitleDirective, CardTextDirective, ButtonDirective]
})
export class CardUtilitiesComponent {}
<c-card class="w-75 mb-4">
  <c-card-body>
    <h5 cCardTitle>Card title</h5>
    <p cCardText>
      Some quick example text to build on the card title and make up the bulk of the card's content.
    </p>
    <button cButton color="primary">Go somewhere</button>
  </c-card-body>
</c-card>
<c-card class="w-50 mb-4">
  <c-card-body>
    <h5 cCardTitle>Card title</h5>
    <p cCardText>
      Some quick example text to build on the card title and make up the bulk of the card's content.
    </p>
    <button cButton color="primary">Go somewhere</button>
  </c-card-body>
</c-card>

Using custom CSS

Use custom CSS in your stylesheets or as inline styles to set a width.

import { Component } from '@angular/core';
import {
  ButtonDirective,
  CardBodyComponent,
  CardComponent,
  CardTextDirective,
  CardTitleDirective
} from '@coreui/angular';

@Component({
  selector: 'docs-card-custom-css',
  templateUrl: './card-custom-css.component.html',
  styleUrls: ['./card-base.component.scss'],
  imports: [CardComponent, CardBodyComponent, CardTitleDirective, CardTextDirective, ButtonDirective]
})
export class CardCustomCssComponent {}
<c-card>
  <c-card-body>
    <h5 cCardTitle>Card title</h5>
    <p cCardText>
      Some quick example text to build on the card title and make up the bulk of the card's content.
    </p>
    <button cButton color="primary">Go somewhere</button>
  </c-card-body>
</c-card>
:host {
  c-card {
    min-width: 9rem;
    .list-group {
      max-width: 100%;
    }
  }
}

Text alignment

You can instantly change the text arrangement of any card—in its whole or specific parts—with text align classes.

import { Component } from '@angular/core';
import {
  ButtonDirective,
  CardBodyComponent,
  CardComponent,
  CardTextDirective,
  CardTitleDirective
} from '@coreui/angular';

@Component({
  selector: 'docs-card-text-alignment',
  templateUrl: './card-text-alignment.component.html',
  styleUrls: ['./card-base.component.scss'],
  imports: [CardComponent, CardBodyComponent, CardTitleDirective, CardTextDirective, ButtonDirective]
})
export class CardTextAlignmentComponent {}
<c-card class="mb-4">
  <c-card-body>
    <h5 cCardTitle>Card title</h5>
    <p cCardText>
      Some quick example text to build on the card title and make up the bulk of the card's content.
    </p>
    <button cButton color="primary">Go somewhere</button>
  </c-card-body>
</c-card>
<c-card class="text-center mb-4">
  <c-card-body>
    <h5 cCardTitle>Card title</h5>
    <p cCardText>
      Some quick example text to build on the card title and make up the bulk of the card's content.
    </p>
    <button cButton color="primary">Go somewhere</button>
  </c-card-body>
</c-card>
<c-card class="text-end mb-4">
  <c-card-body>
    <h5 cCardTitle>Card title</h5>
    <p cCardText>
      Some quick example text to build on the card title and make up the bulk of the card's content.
    </p>
    <button cButton color="primary">Go somewhere</button>
  </c-card-body>
</c-card>
:host {
  c-card {
    min-width: 9rem;
    .list-group {
      max-width: 100%;
    }
  }
}

Add some navigation to a c-card with our c-tabs component.

import { NgTemplateOutlet } from '@angular/common';
import { Component } from '@angular/core';
import {
  ButtonDirective,
  CardBodyComponent,
  CardComponent,
  CardHeaderComponent,
  CardTextDirective,
  CardTitleDirective,
  TabDirective,
  TabPanelComponent,
  TabsComponent,
  TabsContentComponent,
  TabsListComponent
} from '@coreui/angular';

@Component({
  selector: 'docs-card-navigation',
  templateUrl: './card-navigation.component.html',
  imports: [
    CardComponent,
    CardHeaderComponent,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective,
    ButtonDirective,
    TabsListComponent,
    TabDirective,
    TabsContentComponent,
    TabPanelComponent,
    TabsComponent,
    NgTemplateOutlet
  ]
})
export class CardNavigationComponent {
  tabs = ['Active', 'List', 'Disabled'];
}
<c-tabs activeItemKey="Active">
  <c-card class="text-center">
    <c-card-header>
      <c-tabs-list class="card-header-tabs" variant="tabs">
        @for (tab of tabs; track tab) {
          <button [itemKey]="tab" cTab [disabled]="tab === 'Disabled'">
            {{ tab }}
          </button>
        }
      </c-tabs-list>
    </c-card-header>
    <c-card-body>
      <c-tabs-content>
        @for (panel of tabs; track panel) {
          <c-tab-panel [itemKey]="panel">
            <ng-container *ngTemplateOutlet="cardBodyTemplate; context: { $implicit: panel }" />
          </c-tab-panel>
        }
      </c-tabs-content>
    </c-card-body>
  </c-card>
</c-tabs>

<ng-template #cardBodyTemplate let-title>
  <h5 cCardTitle>Card {{ title ?? 'title' }}</h5>
  <p cCardText>Some quick example text to build on the card title and make up the bulk of the card's content.</p>
  <button cButton color="primary">Go somewhere</button>
</ng-template>
import { NgTemplateOutlet } from '@angular/common';
import { Component } from '@angular/core';
import {
  ButtonDirective,
  CardBodyComponent,
  CardComponent,
  CardHeaderComponent,
  CardTextDirective,
  CardTitleDirective,
  TabDirective,
  TabPanelComponent,
  TabsComponent,
  TabsContentComponent,
  TabsListComponent
} from '@coreui/angular';

@Component({
  selector: 'docs-card-navigation-2',
  templateUrl: './card-navigation-2.component.html',
  imports: [
    CardComponent,
    CardHeaderComponent,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective,
    ButtonDirective,
    TabsListComponent,
    TabDirective,
    TabsContentComponent,
    TabPanelComponent,
    TabsComponent,
    NgTemplateOutlet
  ]
})
export class CardNavigation2Component {
  tabs = ['Active', 'List', 'Disabled'];
}
<c-tabs activeItemKey="Active">
  <c-card class="text-center">
    <c-card-header>
      <c-tabs-list class="card-header-pills" variant="pills">
        @for (tab of tabs; track tab) {
          <button [itemKey]="tab" cTab [disabled]="tab === 'Disabled'">
            {{ tab }}
          </button>
        }
      </c-tabs-list>
    </c-card-header>
    <c-card-body>
      <c-tabs-content>
        @for (panel of tabs; track panel) {
          <c-tab-panel [itemKey]="panel">
            <ng-container *ngTemplateOutlet="cardBodyTemplate; context: { $implicit: panel }" />
          </c-tab-panel>
        }
      </c-tabs-content>
    </c-card-body>
  </c-card>
</c-tabs>

<ng-template #cardBodyTemplate let-title>
  <h5 cCardTitle>Card {{ title ?? 'title' }}</h5>
  <p cCardText>Some quick example text to build on the card title and make up the bulk of the card's content.</p>
  <button cButton color="primary">Go somewhere</button>
</ng-template>

Images

Cards introduce several options for acting with images. Pick from appending “image caps” at either end of a card, overlaying images with content, or just inserting the image in a card.

Image caps

Similar to headers and footers, cards can include top and bottom “image caps”—images at the top or bottom of a card.

import { Component } from '@angular/core';
import {
  CardBodyComponent,
  CardComponent,
  CardImgDirective,
  CardTextDirective,
  CardTitleDirective,
  ColComponent,
  RowComponent
} from '@coreui/angular';

@Component({
  selector: 'docs-card-image-caps',
  templateUrl: './card-image-caps.component.html',
  imports: [
    RowComponent,
    ColComponent,
    CardComponent,
    CardImgDirective,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective
  ]
})
export class CardImageCapsComponent {}
<c-row>
  <c-col>
    <c-card class="mb-3">
      <img cCardImg="top" src="/assets/img/angular.jpg">
      <c-card-body>
        <h5 cCardTitle>Card title</h5>
        <p cCardText>
          This is a wider card with supporting text below as a natural lead-in to
          additional content. This content is a little bit longer.
        </p>
        <p cCardText>
          <small class="text-medium-emphasis">Last updated 3 mins ago</small>
        </p>
      </c-card-body>
    </c-card>
  </c-col>
  <c-col>
    <c-card class="mb-3">
      <c-card-body>
        <h5 cCardTitle>Card title</h5>
        <p cCardText>
          This is a wider card with supporting text below as a natural lead-in to
          additional content. This content is a little bit longer.
        </p>
        <p cCardText>
          <small class="text-medium-emphasis">Last updated 3 mins ago</small>
        </p>
      </c-card-body>
      <img cCardImg="bottom" src="/assets/img/angular.jpg">
    </c-card>
  </c-col>
</c-row>

Image overlays

Adapt an image into a background and overlay your text. Depending on the image, you may need additional styles or utilities.

import { Component } from '@angular/core';
import {
  CardComponent,
  CardImgDirective,
  CardImgOverlayComponent,
  CardTextDirective,
  CardTitleDirective
} from '@coreui/angular';

@Component({
  selector: 'docs-card-image-overlays',
  templateUrl: './card-image-overlays.component.html',
  imports: [CardComponent, CardImgDirective, CardImgOverlayComponent, CardTitleDirective, CardTextDirective]
})
export class CardImageOverlaysComponent {}
<c-card class="mb-3">
  <img [cCardImg] src="/assets/img/angular.jpg" alt="CoreUI Angular Logo">
  <c-card-img-overlay>
    <h5 cCardTitle>Card title</h5>
    <p cCardText>
      This is a wider card with supporting text below as a natural lead-in to
      additional content. This content is a little bit longer.
    </p>
    <p cCardText>
      <small class="text-medium-emphasis">Last updated 3 mins ago</small>
    </p>
  </c-card-img-overlay>
</c-card>

Horizontal

Using a combination of grid and utility classes, cards can be made horizontal in a mobile-friendly and responsive way. In the example below, we remove the grid gutters with .g-0 and use .col-md-* classes to make the card horizontal at the md breakpoint. Further adjustments may be needed depending on your card content.

import { NgStyle } from '@angular/common';
import { Component } from '@angular/core';
import {
  CardBodyComponent,
  CardComponent,
  CardImgDirective,
  CardTextDirective,
  CardTitleDirective,
  ColComponent,
  ColDirective,
  RowComponent
} from '@coreui/angular';

@Component({
  selector: 'docs-card-horizontal',
  templateUrl: './card-horizontal.component.html',
  styleUrls: ['./card-horizontal.component.scss'],
  imports: [
    CardComponent,
    NgStyle,
    RowComponent,
    ColComponent,
    CardImgDirective,
    CardBodyComponent,
    ColDirective,
    CardTitleDirective,
    CardTextDirective
  ]
})
export class CardHorizontalComponent {}
<c-card class="mb-3" [ngStyle]="{'max-width.px': 540}">
  <c-row class="g-0">
    <c-col [md]="4" class="overflow-hidden position-relative">
      <img cCardImg="start" src="/assets/img/angular400.jpg" alt="CoreUI Angular Logo" class="d-none d-md-inline object-fit-cover" style="min-height: 100%; object-position: left">
      <img cCardImg="top" src="/assets/img/angular.jpg" alt="CoreUI Angular Logo" class="d-md-none d-sm-inline">
    </c-col>
    <c-card-body cCol [md]="8">
      <h5 cCardTitle>Card title</h5>
      <p cCardText>
        This is a wider card with supporting text below as a natural lead-in to
        additional content. This content is a little bit longer.
      </p>
      <p cCardText>
        <small class="text-medium-emphasis">Last updated 3 mins ago</small>
      </p>
    </c-card-body>
  </c-row>
</c-card>
.image-container {
  overflow: hidden;
  position: relative;
}
.responsive-img {
  min-height: 100%;
  object-fit: cover; /* Ensures the image covers the container */
  object-position: left; /* Adjusts the position of the image within the container */
}

Card styles

Cards include various options for customizing their backgrounds, borders, and color.

Background and color

Use color property to change the appearance of a card.

import { Component } from '@angular/core';

import {
  ButtonDirective,
  CardBodyComponent,
  CardComponent,
  CardHeaderComponent,
  CardTextDirective,
  CardTitleDirective,
  ColComponent,
  RowComponent
} from '@coreui/angular';

@Component({
  selector: 'docs-card-background-color',
  templateUrl: './card-background-color.component.html',
  imports: [
    RowComponent,
    ColComponent,
    CardComponent,
    CardHeaderComponent,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective,
    ButtonDirective
  ]
})
export class CardBackgroundColorComponent {
  colors = [
    { color: 'primary', textColor: 'primary' },
    { color: 'secondary', textColor: 'secondary' },
    { color: 'success', textColor: 'success' },
    { color: 'danger', textColor: 'danger' },
    { color: 'warning', textColor: 'warning' },
    { color: 'info', textColor: 'info' },
    { color: 'light', textColor: '' },
    { color: 'dark', textColor: '' }
  ];
}
<c-row>
  @for (item of colors; track item.color; let i = $index) {
    <c-col [lg]="4">
      <c-card [color]="item.color"
              [textColor]="item.color === 'warning' || item.color === 'light' ? '' :  'white'"
              class="mb-3">
        <c-card-header>Header</c-card-header>
        <c-card-body class="bg-gradient">
          <h5 cCardTitle>{{ item.color }} card title</h5>
          <p cCardText>
            Some quick example text to build on the card title and make up the bulk of
            the card&#39;s content.
          </p>
          <button [color]="item.color" cButton class="shadow">Go somewhere</button>
        </c-card-body>
      </c-card>
    </c-col>
  }
</c-row>

Border

Use border utilities to change just the border-color of a card. Note that you can set textColor property on the cCard or a subset of the card’s contents as shown below.

import { Component } from '@angular/core';

import {
  BorderDirective,
  ButtonDirective,
  CardBodyComponent,
  CardComponent,
  CardHeaderComponent,
  CardTextDirective,
  CardTitleDirective,
  ColComponent,
  RowComponent
} from '@coreui/angular';

@Component({
  selector: 'docs-card-border',
  templateUrl: './card-border.component.html',
  imports: [
    RowComponent,
    ColComponent,
    CardComponent,
    BorderDirective,
    CardHeaderComponent,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective,
    ButtonDirective
  ]
})
export class CardBorderComponent {
  colors = [
    { color: 'primary', textColor: 'primary' },
    { color: 'secondary', textColor: 'secondary' },
    { color: 'success', textColor: 'success' },
    { color: 'danger', textColor: 'danger' },
    { color: 'warning', textColor: 'warning' },
    { color: 'info', textColor: 'info' },
    { color: 'light', textColor: '' },
    { color: 'dark', textColor: '' }
  ];
}
<c-row>
  @for (item of colors; track item.color; let i = $index) {
    <c-col [lg]="4">
      <c-card [cBorder]="item.color" [textColor]="item.textColor" class="mb-3">
        <c-card-header>Header</c-card-header>
        <c-card-body>
          <h5 cCardTitle>{{ item.color }} card title</h5>
          <p cCardText>
            Some quick example text to build on the card title and make up the bulk of
            the card&#39;s content.
          </p>
          <button [color]="item.color" cButton>Go somewhere</button>
        </c-card-body>
      </c-card>
    </c-col>
  }
</c-row>

Top border

Use border utilities to change just the accent of a card.

import { Component } from '@angular/core';

import {
  BorderDirective,
  ButtonDirective,
  CardBodyComponent,
  CardComponent,
  CardHeaderComponent,
  CardTextDirective,
  CardTitleDirective,
  ColComponent,
  RowComponent
} from '@coreui/angular';

@Component({
  selector: 'docs-card-top-border',
  templateUrl: './card-top-border.component.html',
  imports: [
    RowComponent,
    ColComponent,
    CardComponent,
    BorderDirective,
    CardHeaderComponent,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective,
    ButtonDirective
  ]
})
export class CardTopBorderComponent {
  colors = [
    { color: 'primary', textColor: 'primary' },
    { color: 'secondary', textColor: 'secondary' },
    { color: 'success', textColor: 'success' },
    { color: 'danger', textColor: 'danger' },
    { color: 'warning', textColor: 'warning' },
    { color: 'info', textColor: 'info' },
    { color: 'light', textColor: '' },
    { color: 'dark', textColor: '' }
  ];
}
<c-row>
  @for (item of colors; track item.color; let i = $index) {
    <c-col [lg]="4">
      <c-card [cBorder]="{top: {color: item.color, width: 3}}" [textColor]="item.textColor" class="mb-3">
        <c-card-header>Header</c-card-header>
        <c-card-body>
          <h5 cCardTitle>{{ item.color }} card title</h5>
          <p cCardText>
            Some quick example text to build on the card title and make up the bulk of
            the card&#39;s content.
          </p>
          <button [color]="item.color" cButton>Go somewhere</button>
        </c-card-body>
      </c-card>
    </c-col>
  }
</c-row>

Card layout

In addition to styling the content within cards, CoreUI includes a few options for laying out series of cards. For the time being, these layout options are not yet responsive.

Card groups

Use card groups to render cards as a single, attached element with equal width and height columns. Card groups start off stacked and use display: flex; to become attached with uniform dimensions starting at the sm breakpoint.

import { Component } from '@angular/core';
import {
  CardBodyComponent,
  CardComponent,
  CardGroupComponent,
  CardImgDirective,
  CardTextDirective,
  CardTitleDirective
} from '@coreui/angular';

@Component({
  selector: 'docs-card-groups',
  templateUrl: './card-groups.component.html',
  imports: [
    CardGroupComponent,
    CardComponent,
    CardImgDirective,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective
  ]
})
export class CardGroupsComponent {}
<c-card-group class="mb-4">
  <c-card>
    <img cCardImg="top" src="/assets/img/angular.jpg">
    <c-card-body>
      <h5 cCardTitle>Card title</h5>
      <p cCardText>
        This is a wider card with supporting text below as a natural lead-in to
        additional content. This content is a little bit longer.
      </p>
      <p cCardText>
        <small class="text-medium-emphasis">Last updated 3 mins ago</small>
      </p>
    </c-card-body>
  </c-card>
  <c-card>
    <img cCardImg="top" src="/assets/img/angular.jpg">
    <c-card-body>
      <h5 cCardTitle>Card title</h5>
      <p cCardText>
        This card has supporting text below as a natural lead-in to additional
        content.
      </p>
      <p cCardText>
        <small class="text-medium-emphasis">Last updated 3 mins ago</small>
      </p>
    </c-card-body>
  </c-card>
  <c-card>
    <img cCardImg="top" src="/assets/img/angular.jpg">
    <c-card-body>
      <h5 cCardTitle>Card title</h5>
      <p cCardText>
        This is a wider card with supporting text below as a natural lead-in to
        additional content. This card has even longer content than the first to show
        that equal height action.
      </p>
      <p cCardText>
        <small class="text-medium-emphasis">Last updated 3 mins ago</small>
      </p>
    </c-card-body>
  </c-card>
</c-card-group>

Card groups with footers

When using card groups with footers, their content will automatically line up.

import { Component } from '@angular/core';
import {
  CardBodyComponent,
  CardComponent,
  CardFooterComponent,
  CardGroupComponent,
  CardImgDirective,
  CardTextDirective,
  CardTitleDirective
} from '@coreui/angular';

@Component({
  selector: 'docs-card-groups-with-footers',
  templateUrl: './card-groups-with-footers.component.html',
  imports: [
    CardGroupComponent,
    CardComponent,
    CardImgDirective,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective,
    CardFooterComponent
  ]
})
export class CardGroupsWithFootersComponent {}
<c-card-group class="mb-4">
  <c-card>
    <img cCardImg="top" src="/assets/img/angular.jpg">
    <c-card-body>
      <h5 cCardTitle>Card title</h5>
      <p cCardText>
        This is a wider card with supporting text below as a natural lead-in to
        additional content. This content is a little bit longer.
      </p>
    </c-card-body>
    <c-card-footer>
      <small class="text-medium-emphasis">Last updated 3 mins ago</small>
    </c-card-footer>
  </c-card>
  <c-card>
    <img cCardImg="top" src="/assets/img/angular.jpg">
    <c-card-body>
      <h5 cCardTitle>Card title</h5>
      <p cCardText>
        This card has supporting text below as a natural lead-in to additional
        content.
      </p>
    </c-card-body>
    <c-card-footer>
      <small class="text-medium-emphasis">Last updated 3 mins ago</small>
    </c-card-footer>
  </c-card>
  <c-card>
    <img cCardImg="top" src="/assets/img/angular.jpg">
    <c-card-body>
      <h5 cCardTitle>Card title</h5>
      <p cCardText>
        This is a wider card with supporting text below as a natural lead-in to
        additional content. This card has even longer content than the first to show
        that equal height action.
      </p>
    </c-card-body>
    <c-card-footer>
      <small class="text-medium-emphasis">Last updated 3 mins ago</small>
    </c-card-footer>
  </c-card>
</c-card-group>

Grid cards

Use the c-row component and set xs|sm|md|lg|xl|xxl property to control how many grid columns (wrapped around your cards) you show per row. For example [xs]="1" laying out the cards on one column, and [md]="1" splitting four cards to equal width across multiple rows, from the medium breakpoint up.

import { Component } from '@angular/core';

import {
  CardBodyComponent,
  CardComponent,
  CardFooterComponent,
  CardImgDirective,
  CardTextDirective,
  CardTitleDirective,
  ColComponent,
  GutterDirective,
  RowComponent
} from '@coreui/angular';

@Component({
  selector: 'docs-card-grid-cards',
  templateUrl: './card-grid-cards.component.html',
  imports: [
    RowComponent,
    GutterDirective,
    ColComponent,
    CardComponent,
    CardImgDirective,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective,
    CardFooterComponent
  ]
})
export class CardGridCardsComponent {
  cards = new Array(4);
}
<c-row [gutter]="4" class="mb-3" [md]="2" [xs]="1">
  @for (card of cards; track i; let i = $index) {
    <c-col>
      <c-card>
        <img cCardImg="top" src="/assets/img/angular.jpg" alt="angular">
        <c-card-body>
          <h5 cCardTitle>Card title</h5>
          <p cCardText>
            This is a wider card with supporting text below as a natural lead-in to
            additional content. This content is a little bit longer.
          </p>
        </c-card-body>
        <c-card-footer>
          <small class="text-medium-emphasis">Last updated 3 mins ago</small>
        </c-card-footer>
      </c-card>
    </c-col>
  }
</c-row>

Change it to [md]="3" and you’ll see the fourth card wraps.

import { Component } from '@angular/core';

import {
  CardBodyComponent,
  CardComponent,
  CardFooterComponent,
  CardImgDirective,
  CardTextDirective,
  CardTitleDirective,
  ColComponent,
  GutterDirective,
  RowComponent
} from '@coreui/angular';

@Component({
  selector: 'docs-card-grid-cards-2',
  templateUrl: './card-grid-cards-2.component.html',
  imports: [
    RowComponent,
    GutterDirective,
    ColComponent,
    CardComponent,
    CardImgDirective,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective,
    CardFooterComponent
  ]
})
export class CardGridCards2Component {
  cards = new Array(4).fill({ body: '' });
}
<c-row [gutter]="4" class="mb-3" [md]="3" [xs]="1">
  @for (card of cards; track i; let i = $index) {
    <c-col>
      <c-card>
        <img cCardImg="top" src="/assets/img/angular.jpg" alt="angular">
        <c-card-body>
          <h5 cCardTitle>Card title</h5>
          <p cCardText>
            This is a wider card with supporting text below as a natural lead-in to
            additional content. This content is a little bit longer.
          </p>
        </c-card-body>
        <c-card-footer>
          <small class="text-medium-emphasis">Last updated 3 mins ago</small>
        </c-card-footer>
      </c-card>
    </c-col>
  }
</c-row>

When you need equal height, add .h-100 to the cards. If you want equal heights by default, you can set $card-height: 100% in Sass.

import { Component, OnInit } from '@angular/core';

import {
  CardBodyComponent,
  CardComponent,
  CardImgDirective,
  CardTextDirective,
  CardTitleDirective,
  ColComponent,
  GutterDirective,
  RowComponent
} from '@coreui/angular';

@Component({
  selector: 'docs-card-grid-cards-3',
  templateUrl: './card-grid-cards-3.component.html',
  imports: [
    RowComponent,
    GutterDirective,
    ColComponent,
    CardComponent,
    CardImgDirective,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective
  ]
})
export class CardGridCards3Component implements OnInit {
  cards = new Array(4).fill({ body: '' });

  ngOnInit(): void {
    this.cards[0] = {
      body: 'This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.'
    };
    this.cards[1] = { body: 'This card has supporting text below as a natural lead-in to additional content.' };
    this.cards[2] = {
      body: 'This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.'
    };
    this.cards[3] = {
      body: 'This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.'
    };
  }
}
<c-row [gutter]="4" class="mb-3" [md]="3" [xs]="1">
  @for (card of cards; track i; let i = $index) {
    <c-col>
      <c-card class="h-100">
        <img cCardImg="top" src="/assets/img/angular.jpg" alt="angular">
        <c-card-body>
          <h5 cCardTitle>Card title</h5>
          <p cCardText>
            {{ card.body }}
          </p>
        </c-card-body>
      </c-card>
    </c-col>
  }
</c-row>

Just like with card groups, card footers will automatically line up.

import { Component, OnInit } from '@angular/core';
import {
  CardBodyComponent,
  CardComponent,
  CardFooterComponent,
  CardImgDirective,
  CardTextDirective,
  CardTitleDirective,
  ColComponent,
  GutterDirective,
  RowComponent
} from '@coreui/angular';

@Component({
  selector: 'docs-card-grid-cards-4',
  templateUrl: './card-grid-cards-4.component.html',
  imports: [
    RowComponent,
    GutterDirective,
    ColComponent,
    CardComponent,
    CardImgDirective,
    CardBodyComponent,
    CardTitleDirective,
    CardTextDirective,
    CardFooterComponent
  ]
})
export class CardGridCards4Component implements OnInit {
  cards = new Array(4).fill({ body: '' });

  ngOnInit(): void {
    this.cards[0] = {
      body: 'This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.'
    };
    this.cards[1] = { body: 'This card has supporting text below as a natural lead-in to additional content.' };
    this.cards[2] = {
      body: 'This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.'
    };
    this.cards[3] = {
      body: 'This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.'
    };
  }
}
<c-row [gutter]="4" class="mb-3" [md]="3" [xs]="1">
  @for (card of cards; track i; let i = $index) {
    <c-col>
      <c-card class="h-100">
        <img cCardImg="top" src="/assets/img/angular.jpg" alt="angular">
        <c-card-body>
          <h5 cCardTitle>Card title</h5>
          <p cCardText>
            {{ card.body }}
          </p>
        </c-card-body>
        <c-card-footer>
          <small class="text-medium-emphasis">Last updated {{ i + 10 }} mins ago</small>
        </c-card-footer>
      </c-card>
    </c-col>
  }
</c-row>

API reference

CardModule

import { CardModule } from '@coreui/angular';

@NgModule({
    imports: [CardModule,]
})
export class AppModule() { }

c-card

component

jsx
import { CardComponent } from '@coreui/angular'
PropertyDefaultType
color-string

Sets the color context of the component to one of CoreUI’s themed colors.

textBgColor5.0.0+-string

Sets the component's color scheme to one of CoreUI themed colors, ensuring the text color contrast adheres to the WCAG 4.5:1 contrast ratio standard for accessibility. via TextBgColorDirective

textColor-string

Sets the text color context of the component to one of CoreUI’s themed colors. via TextColorDirective

c-card-body

component

jsx
import { CardBodyComponent } from '@coreui/angular'

component

jsx
import { CardFooterComponent } from '@coreui/angular'

c-card-header

component

jsx
import { CardHeaderComponent } from '@coreui/angular'

c-card-group

component

jsx
import { CardGroupComponent } from '@coreui/angular'

c-card-img-overlay

component

jsx
import { CardImgOverlayComponent } from '@coreui/angular'

cCardImg

directive

jsx
import { CardImgDirective } from '@coreui/angular'
PropertyDefaultType
cCardImgundefined'top', 'bottom', 'start', 'end'

Optionally orientate the image to the top, bottom, or make it overlaid across the card.

directive

jsx
import { CardLinkDirective } from '@coreui/angular'

cCardSubtitle

directive

jsx
import { CardSubtitleDirective } from '@coreui/angular'

cCardText

directive

jsx
import { CardTextDirective } from '@coreui/angular'

cCardTitle

directive

jsx
import { CardTitleDirective } from '@coreui/angular'