The Card component theme can be customized using a theme object containing three main sections:
defaultProps: Sets default values for Card props (e.g., variant, color, shadow, className).valid: Defines the allowed values for props, such as variants and colors.styles: Defines the actual Tailwind CSS classes for the component. This is subdivided into base (for initial and shadow states) and variants (for filled and gradient styles).
You can customize these by mapping Tailwind CSS classes to specific keys within the theme object.
const theme = {
card: {
defaultProps: {
variant: "filled",
color: "white",
shadow: true,
className: "",
},
valid: {
variants: ["filled", "gradient"],
colors: ["transparent", "white", "blue-gray", "gray", "brown", "deep-orange", "orange", "amber", "yellow", "lime", "light-green", "green", "teal", "cyan", "light-blue", "blue", "indigo", "deep-purple", "purple", "pink", "red"],
},
styles: {
base: {
initial: {
position: "relative",
display: "flex",
flexDirection: "flex-col",
backgroundClip: "bg-clip-border",
borderRadius: "rounded-xl",
},
shadow: {
boxShadow: "shadow-md",
},
},
variants: {
filled: {
white: {
backgroud: "bg-white",
color: "text-gray-700",
},
// ... other colors
},
gradient: {
blue: {
backgroud: "bg-gradient-to-tr from-blue-600 to-blue-400",
color: "text-white",
shadow: "shadow-blue-500/40",
},
// ... other colors
},
},
},
},
};