Skip to content

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.

Code Demo
Card Title

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.

Code Demo
Small Card

200px × 150px

Medium Card

300px × 200px

Large Card

400px × 250px

展开代码

Custom Background Color ​

Use the backgroundColor prop to customize the card's background color.

Code Demo
Light Blue Card

Custom background color

#f0f9ff

Light Red Card

Custom background color

#fef2f2

Light Green Card

Custom background color

#f0fdf4

展开代码

Product Display Card ​

Use cards to display product information.

Code Demo
MacBook Pro¥12999
💻

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.

Code Demo
U
Zhang San
Premium User
Email
zhangsan@example.com
Phone
138****1234
Department
Technology
Position
Frontend Engineer
展开代码

Data Statistics Card ​

Use cards to display data statistics.

Code Demo
1,234
Daily Visits
567
New Users
89.5%
Conversion Rate
¥12,345
Daily Revenue
展开代码

API Reference ​

Props ​

PropDescriptionTypeOptionsDefault
titleCard titlestring—''
widthCard widthstring—''
heightCard heightstring—''
footerCard footer contentstring—''
background-colorCard background colorstring—''

Slots ​

Slot NameDescription
headerCard header content
bodyCard body content
footerCard footer content

Type Definitions ​

typescript
interface CardProps {
  title?: string;
  width?: string;
  height?: string;
  footer?: string;
  backgroundColor?: string;
}

Released under the MIT License.