Skip to content

Card - Vant 4

Card

🛍️ Create stunning product showcases with beautiful card layouts that captivate your users!

Intro 📋

Perfect for e-commerce and content display! The Card component beautifully showcases product images, prices, descriptions, and more in an elegant, mobile-optimized layout! 🎨✨

Install 📦

Get started in seconds! Register the Card component globally and start building beautiful product displays! 🚀

js
import { createApp } from'vue'; import { Card } from'vant'; const app = createApp(); app.use(Card);

Usage 🎯

Basic Usage 🌟

Create your first product card with just a few props - it's that simple! Perfect for showcasing products with images, titles, and prices! 💫

html

Discount Info 🏷️

Show off those amazing deals! Display original prices with strikethrough and highlight discounts to boost conversions! 💰

html

Custom Content 🎨

Make it uniquely yours! Use slots to customize any part of the card - from headers to footers, the possibilities are endless! ✨

html

API

Props

AttributeDescriptionTypeDefault
thumbLeft thumb image URLstring-
titleTitlestring-
descDescriptionstring-
tagTagstring-
numnumber*numberstring*
pricePrice*numberstring*
origin-priceOrigin price*numberstring*
centeredWhether content vertical centeredbooleanfalse
currencyCurrency symbolstring��
thumb-linkThumb link URLstring-
lazy-loadWhether to enable thumb lazy load, should register Lazyload componentbooleanfalse

Events

EventDescriptionArguments
clickEmitted when component is clickedevent: MouseEvent
click-thumbEmitted when thumb is clickedevent: MouseEvent

Slots

NameDescription
titleCustom title
descCustom description
numCustom num
priceCustom price
origin-priceCustom origin price
price-topCustom price top
bottomCustom price bottom
thumbCustom thumb
tagCustom thumb tag
tagsCustom tags
footerCustom footer

Types

The component exports the following type definitions:

ts
importtype { CardProps } from'vant';

Theming

CSS Variables

The component provides the following CSS variables, which can be used to customize styles. Please refer to ConfigProvider component.

NameDefault ValueDescription
--van-card-paddingvar(--van-padding-xs) var(--van-padding-md)-
--van-card-font-sizevar(--van-font-size-sm)-
--van-card-text-colorvar(--van-text-color)-
--van-card-backgroundvar(--van-background)-
--van-card-thumb-size88px-
--van-card-thumb-radiusvar(--van-radius-lg)-
--van-card-title-line-height16px-
--van-card-desc-colorvar(--van-text-color-2)-
--van-card-desc-line-heightvar(--van-line-height-md)-
--van-card-price-colorvar(--van-text-color)-
--van-card-origin-price-colorvar(--van-text-color-2)-
--van-card-num-colorvar(--van-text-color-2)-
--van-card-origin-price-font-sizevar(--van-font-size-xs)-
--van-card-price-font-sizevar(--van-font-size-sm)-
--van-card-price-integer-font-sizevar(--van-font-size-lg)-
--van-card-price-fontvar(--van-price-font)-

## Related Docs 📚

- [Image](./image) - Display product images
- [Tag](./tag) - Add product tags and labels
- [Button](./button) - Add action buttons to cards
- [Badge](./badge) - Show notifications and counts
- [Lazyload](./lazyload) - Optimize image loading
- [Grid](./grid) - Layout multiple cards
- [List](./list) - Create card lists
- [ConfigProvider](./config-provider) - Global configuration
- [Advanced Usage](./advanced-usage) - Component registration guide

Enterprise-level mobile solution based on Vant