The Card component is a versatile container component used to organize content within a card container with rounded corners, shadow, and border. Simply pass the content to be displayed as the default Snippet.
The Card component provides three background types:
For more custom backgrounds, you can inject custom CSS class names through the injClass property.
The Card component provides three preset areas:
All three areas are optional and can be flexibly combined according to actual needs.
By default, divider lines are displayed between the header and body content, and between the body content and footer. You can control whether to show divider lines through the headerLine and footerLine properties.
The radius property can be used to configure the border radius of the card, supporting various options from none (no radius) to full (fully rounded).
The shadow property can be used to configure the shadow effect of the card, supporting various options from none (no shadow) to 2xl (extra large shadow). The shadow will automatically adjust to a suitable style in dark mode.
p property to uniformly set padding for the body content area in all four directionspx and py properties to separately set horizontal and vertical paddingpx or py is set, the p property will not take effectborder property to configure border style: solid, dashed, dottedborderWidth property to configure border thicknessborder is none, border-related configurations will not take effectWhen an onclick event handler is provided, the card will render as a button element with clickable interaction.
The Card component provides multiple CSS injection properties to inject custom styles into different areas:
injClass: Inject styles into the card containerheaderClass: Inject styles into the header areabodyClass: Inject styles into the body content areafooterClass: Inject styles into the footer areaIf the injected class name does not take effect, add a ! before the class name, as demonstrated in the Tailwind Important Modifier.