Learn how to customize the theme and styles for button component, the theme object for button component has three main objects:
A. The defaultProps
object for setting up the default value for props of button component.
B. The valid
object for customizing the valid values for button component props.
C. The styles
object for customizing the theme and styles of button component.
You can customize the theme and styles of button component by adding Tailwind CSS classes as key paired values for objects.
interface ButtonStyleTypes {
defaultProps: {
variant: string;
size: string;
color: string;
fullWidth: boolean;
ripple: boolean;
className: string;
};
valid: {
variants: string[];
sizes: string[];
colors: string[];
};
styles: {
base: {
initial: object;
fullWidth: object;
};
sizes: {
sm: object;
md: object;
lg: object;
};
variants: {
filled: object;
gradient: object;
outlined: object;
text: object;
};
};
}
import type { ButtonStyleTypes } from "@material-tailwind/react";
const theme = {
button: {
styles: {
sizes: {
sm: {
fontSize: "text-xs",
},
md: {
fontSize: "text-xs",
},
lg: {
fontSize: "text-sm",
},
},
},
},
};