Learn how to customize the theme and styles for card components, the theme object for card components has three main objects:
A. The defaultProps
object for setting up the default value for props of card component.
B. The valid
object for customizing the valid values for card component props.
C. The styles
object for customizing the theme and styles of card component.
You can customize the theme and styles of card components by adding Tailwind CSS classes as key paired values for objects.
interface CardStylesType {
defaultProps: {
variant: string;
color: string;
shadow: boolean;
className: string;
};
valid: {
variants: string[];
colors: string[];
};
styles: {
base: {
initial: object;
shadow: object;
};
variants: {
filled: object;
gradient: object;
};
};
}
import type { CardStylesType } from "@material-tailwind/react";
const theme = {
card: {
styles: {
base: {
initial: {
position: "relative",
},
},
},
},
};
interface CardHeaderStylesType {
defaultProps: {
variant: string;
color: string;
shadow: boolean;
floated: boolean;
className: string;
};
valid: {
variants: string[];
colors: string[];
};
styles: {
base: {
initial: object;
shadow: object;
floated: object;
};
variants: {
filled: object;
gradient: object;
};
};
}
import type { CardHeaderStylesType } from "@material-tailwind/react";
const theme = {
cardHeader: {
styles: {
base: {
initial: {
position: "relative",
},
},
},
},
};
interface CardBodyStylesType {
defaultProps: {
className: string;
};
styles: {
base: object;
};
}
import type { CardBodyStylesType } from "@material-tailwind/react";
const theme = {
cardBody: {
styles: {
base: {
p: "p-6",
},
},
},
};
interface CardFooterStylesType {
defaultProps: {
className: string;
divider: boolean;
};
styles: {
base: {
initial: object;
divider: object;
};
};
}
import type { CardFooterStylesType } from "@material-tailwind/react";
const theme = {
cardFooter: {
styles: {
base: {
initial: {
p: "p-6",
},
},
},
},
};