Skip to content

Card

The Card component is the most versatile container module on a page, used for hosting content, actions, and related information. It offers a rich set of layout variants and decorative elements that can be flexibly combined to meet various content display needs.

Basic Usage

A default card includes a title, content, and footer. Use the title prop for quick setup.

vue

<TCard title="Basic Card">
  This is the main content area of the card. You can place any content here.
  <template #footer>
    Card Footer
  </template>
</TCard>

Card Sizes

Use the size prop to switch between three preset padding sizes for different display scenarios.

View Code
vue

<TCard size="sm" title="Small SM">
  Compact padding, ideal for sidebars or information-dense areas.
</TCard>
<TCard size="md" title="Medium MD (default)">
  Standard padding, suitable for most scenarios.
</TCard>
<TCard size="lg" title="Large LG">
  Relaxed padding, great for visually prominent content blocks.
</TCard>

Card Title and Subtitle

The Card supports setting title and subtitle via both prop and slot approaches. The subtitle renders below the title with a smaller font size and lighter color.

View Code
vue

<TCard title="Main Title" subtitle="A descriptive subtitle text">
  Quickly set title and subtitle using props.
</TCard>

You can also use named slots to insert more complex title content, or use the header-actions slot to add action buttons on the right side of the header.

View Code
vue

<TCard>
  <template #title>
    <div class="d-flex align-items-center gap-2 mb-1">
      <TAvatar src="/avatar.png"/>
      User Info
    </div>
  </template>
  <template #subtitle>
    Rich title with avatar
  </template>
  <template #header-actions>
    <TButton color="primary" ghost>Edit</TButton>
  </template>
  Slots allow for more flexible title area customization.
</TCard>

onlyBody Mode

When onlyBody is enabled, the title and content are merged into a single card-body without a card-header divider, resulting in a cleaner layout.

View Code
vue

<TCard onlyBody title="onlyBody Mode" subtitle="Seamless title and content">
  The divider between the title area and content is removed, giving a more compact and unified visual look.
</TCard>

The Card integrates with Vue Router and native links, allowing it to render as a clickable card.

vue

<TCard href="https://tabler.io" title="External Link">
  Renders as an &lt;a&gt; tag.
</TCard>
<TCard link title="Link Style">
  Adds link style (hover effect) only, with no actual link behavior.
</TCard>

Combine with linkRotate or linkPop for hover interaction effects.

vue

<TCard href="#" linkRotate title="Rotate Effect">
  Slight rotation on hover.
</TCard>
<TCard href="#" linkPop title="Pop Effect">
  Pops up with a deeper shadow on hover.
</TCard>

Card Background Color

Use the bg and textColor props to quickly set background and text colors.

vue

<TCard bg="primary" textColor="primary-fg" title="Primary Card">
  Uses Primary background, text adapts automatically.
</TCard>
<TCard bg="blue-lt" title="Light Card" subtitle="With light background">
  Light backgrounds work well alongside darker cards.
</TCard>

Status Bar

Use statusColor to add a colored indicator bar at a specified position — great for identifying card status categories.

vue

<TCard statusColor="success" title="Success Status">
  Green status bar at the top.
</TCard>
<TCard statusColor="danger" statusPosition="start" title="Error Status">
  Red status bar on the left.
</TCard>
<TCard statusColor="warning" statusPosition="bottom" title="Warning Status">
  Yellow status bar at the bottom.
</TCard>

Active and Inactive States

Use the active and inactive props to indicate the card's enabled state.

vue

<TCard active title="Active State">
  Adds a highlighted left border to indicate the current selection.
</TCard>
<TCard inactive title="Inactive State">
  The card appears grayed out, visually disabled.
</TCard>

Borderless & Stacked

vue

<TCard borderless title="Borderless Card">
  Removes borders and shadows, blending into the background.
</TCard>
<TCard stacked title="Stacked Card">
  Double shadow at the bottom creates a layered effect.
</TCard>

Rotated Effects

Use rotateStart or rotateEnd to give the card a slight tilted perspective.

vue

<TCard rotateStart title="Rotate Start">
  Card tilts to the left (from bottom-right to top-left).
</TCard>
<TCard rotateEnd title="Rotate End">
  Card tilts to the right (from bottom-left to top-right).
</TCard>

Image & Text Layout

The Card supports 4 image positions: top, bottom, start (left), and end (right), with imgRatio controlling the responsive image aspect ratio.

💡 Top/bottom images use CSS background-image with img-responsive container; side images use <img> with a row grid layout, ideal for list-style cards with thumbnails.

View Code
vue

<TCard
    imgSrc="https://picsum.photos/seed/card1/600/300"
    imgPosition="top"
    imgRatio="21x9"
    title="Top Image"
>
  21:9 widescreen top image, perfect as a cover.
</TCard>
<TCard
    imgSrc="https://picsum.photos/seed/card2/600/300"
    imgPosition="bottom"
    imgRatio="16x9"
    title="Bottom Image"
>
  16:9 bottom image — text on top, image below.
</TCard>

Side Image

💡 Responsive Tip: Side image uses order-md-last grid reordering. On narrow screens (such as mobile or the current document's narrow viewport), the image automatically reverts to the default order for a better reading experience.

💡 Layout Tip: In side image mode, the #footer slot content is automatically pushed to the bottom of the card — no extra CSS needed.

View Code
vue

<TCard
    imgSrc="https://picsum.photos/seed/card3/200/200"
    imgPosition="start"
    title="Left Image"
>
  Thumbnail on the left, content on the right — ideal for article list cards.
  <template #footer>
    <a href="#">Read More</a>
  </template>
</TCard>
<TCard
    imgSrc="https://picsum.photos/seed/card4/200/200"
    imgPosition="end"
    title="Right Image"
>
  Image on the right, text on the left.
  <template #footer>
    <a href="#">Read More</a>
  </template>
</TCard>

Image Aspect Ratios

The Card supports 13 responsive image aspect ratios via the imgRatio prop:

imgRatioDescription
1x1Square
2x1Wide landscape
1x2Tall portrait
3x1Extra wide banner
1x3Extra tall
4x1Extreme wide
1x4Extreme tall
4x3Standard photo
3x4Portrait photo
16x9HD video
9x16Phone portrait
21x9Ultra-wide cinematic (default)
9x21Ultra-tall portrait

Default value is 21x9.

Stamp Decoration

Use the #stamp slot to add a stamp decoration in the top-right corner of the card, often used for logos, icons, or brand elements.

When using #stamp, wrap the icon in a <div class="card-stamp-icon"> element. Set the background color with bg-* utility classes (e.g., bg-yellow), and the icon must include the icon class.

vue

<TCard title="Card with Stamp">
  Brand icons or decorative elements can be placed in the top-right corner.
  <template #stamp>
    <div class="card-stamp-icon bg-yellow">
      <IconStar class="icon icon-1" />
    </div>
  </template>
</TCard>

Ribbon

Use the #ribbon slot together with ribbonColor and ribbonPosition props to add a decorative ribbon on the left or top of the card.

View Code
vue

<TCard ribbonColor="red" title="Left Ribbon" subtitle="Default start position">
  Red left-side ribbon.
  <template #ribbon>
    Hot
  </template>
</TCard>
<TCard ribbonColor="orange" ribbonPosition="top" title="Top Ribbon">
  Orange top ribbon with icon.
  <template #ribbon>
    <IconStar/>
  </template>
</TCard>

Add a card footer via the #footer slot. Enable footerTransparent to make the footer background transparent. In side image mode, the footer is automatically pushed to the bottom of the card.

vue

<TCard title="Card with Footer">
  Card content...
  <template #footer>
    <div class="d-flex justify-content-between">
      <span>Updated: 2024-01-01</span>
      <a href="#">Details</a>
    </div>
  </template>
</TCard>
<TCard footerTransparent title="Transparent Footer">
  Card content...
  <template #footer>
    The footer background is transparent, blending into the card body.
  </template>
</TCard>

noBody Mode

When noBody is enabled, the card body content is no longer wrapped in card-body, making it suitable for tables, list groups, and other elements that need seamless fitting.

vue

<TCard title="Table Without Body Wrapper" noBody>
  <div class="table-responsive">
    <table class="table table-vcenter card-table">
      <thead>
      <tr>
        <th>Name</th>
        <th>Role</th>
        <th>City</th>
      </tr>
      </thead>
      <tbody>
      <tr>
        <td>Zhang San</td>
        <td>Frontend Engineer</td>
        <td>Shanghai</td>
      </tr>
      <tr>
        <td>Li Si</td>
        <td>Backend Engineer</td>
        <td>Beijing</td>
      </tr>
      </tbody>
    </table>
  </div>
</TCard>

API

Props

PropDescriptionTypeDefault
bgCard background color. bg="primary"class="bg-primary"TablerColorundefined
textColorCard text color. textColor="primary-fg"class="text-primary-fg"TablerColorundefined
borderlessBorderless modebooleanfalse
footerTransparentTransparent footer modebooleanfalse
hrefLink URL, renders as <a> tagstringundefined
toRouter navigation target, renders as <router-link>RouteLocationRawundefined
linkLink style only (no actual link behavior), combine with linkRotate/linkPopbooleanfalse
linkRotateSlight rotation on hover (requires href/to or link)booleanfalse
linkPopPop up with deeper shadow on hover (requires href/to or link)booleanfalse
noBodyRemove default .card-body wrapper — suitable for tables/list groupsbooleanfalse
onlyBodyTitle and content in same card-body, no card-header dividerbooleanfalse
sizeCard padding size'sm' | 'md' | 'lg'undefined (≈md)
stackedStacked effect (double shadow at bottom)booleanfalse
statusColorStatus bar colorTablerColorundefined
statusPositionStatus bar position'top' | 'start' | 'bottom''top'
titleCard title (prop approach)stringundefined
subtitleCard subtitle, rendered below the title (prop approach)stringundefined
rotateStartCard tilt (bottom-left to top-right)booleanfalse
rotateEndCard tilt (top-left to bottom-right)booleanfalse
activeActive state with highlighted borderbooleanfalse
inactiveInactive state grayed outbooleanfalse
ribbonColorRibbon background colorTablerColorundefined
ribbonPositionRibbon position'start' | 'top''start'
imgSrcImage URLstringundefined
imgPositionImage position'start' | 'end' | 'top' | 'bottom''top'
imgRatioResponsive image aspect ratio'1x1' | '2x1' | '1x2' | '3x1' | '1x3' | '4x1' | '1x4' | '4x3' | '3x4' | '16x9' | '9x16' | '21x9' | '9x21''21x9'
imgAltImage alt text (only for side images)stringundefined

Slots

SlotDescription
defaultCard body content (wrapped by card-body, except in noBody mode)
headerCard header area (overrides the default title + subtitle + header-actions structure)
titleCard title (replaces the prop title rendering position)
subtitleCard subtitle (replaces the prop subtitle rendering position)
header-actionsRight-side action area within the header, rendered in .card-options container
footerCard footer
stampTop-right stamp decoration area
ribbonLeft or top decorative ribbon
imgSide image area (only when imgPosition="start" or "end"), replaces default <img> rendering