Card
Brief Introduction
The Card component is used to display information and content blocks, supporting custom headers, bodies, and footers. mengyue-components has encapsulated it and performed vitest testing. You can use <MYCard></MYCard> or <MYCard /> to implement a card layout.
Basic Usage
Basic Card
Basic card component with header, body, and footer.
This is the main content of the card
Any type of content can be placed here
Custom Size
Use the width and height props to customize the card size.
200px × 150px
300px × 200px
400px × 250px
Custom Background Color
Use the backgroundColor prop to customize the card's background color.
Custom background color
#f0f9ff
Custom background color
#fef2f2
Custom background color
#f0fdf4
Product Display Card
Use cards to display product information.
13-inch, M2 chip, 8GB memory, 256GB storage
- Retina display
- Touch Bar and Touch ID
- Up to 20 hours battery life
User Information Card
Use cards to display user information.
Data Statistics Card
Use cards to display data statistics.
API Reference
Props
| Prop | Description | Type | Options | Default |
|---|---|---|---|---|
| title | Card title | string | — | '' |
| width | Card width | string | — | '' |
| height | Card height | string | — | '' |
| footer | Card footer content | string | — | '' |
| background-color | Card background color | string | — | '' |
Slots
| Slot Name | Description |
|---|---|
| header | Card header content |
| body | Card body content |
| footer | Card footer content |
Type Definitions
interface CardProps {
title?: string;
width?: string;
height?: string;
footer?: string;
backgroundColor?: string;
}