Learn how to customize the theme and styles for dialog components, the theme object for dialog components has three main objects:
A. The defaultProps
object for setting up the default value for props of dialog component.
B. The valid
object for customizing the valid values for dialog component props.
C. The styles
object for customizing the theme and styles of dialog component.
You can customize the theme and styles of dialog components by adding Tailwind CSS classes as key paired values for objects.
interface DialogStylesType {
defaultProps: {
size: string;
dismiss: {
enabled: boolean;
escapeKey: boolean;
referencePointerDown: boolean;
outsidePointerDown: boolean;
ancestorScroll: boolean;
bubbles: boolean;
};
animate: {
mount: object;
unmount: object;
};
className: string;
};
valid: {
sizes: string[];
};
styles: {
base: {
backdrop: object;
container: object;
};
sizes: {
xs: object;
sm: object;
md: object;
lg: object;
xl: object;
xxl: object;
};
};
}
import type { DialogStylesType } from "@material-tailwind/react";
const theme = {
dialog: {
styles: {
sizes: {
xs: {
width: "w-1/4",
minWidth: "min-w-[25%]",
maxWidth: "max-w-[25%]",
},
},
},
},
};
interface DialogHeaderStylesType {
defaultProps: {
className: string;
};
styles: {
base: object;
};
}
import type { DialogHeaderStylesType } from "@material-tailwind/react";
const theme = {
dialogHeader: {
styles: {
base: {
display: "flex",
alignItems: "items-center",
},
},
},
};
interface DialogBodyStylesType {
defaultProps: {
className: string;
divider: boolean;
};
styles: {
base: {
initial: object;
divider: object;
};
};
}
import type { DialogBodyStylesType } from "@material-tailwind/react";
const theme = {
dialogBody: {
styles: {
base: {
divider: {
borderTop: "border-t",
borderBottom: "border-b",
},
},
},
},
};
interface DialogFooterStylesType {
defaultProps: {
className: string;
};
styles: {
base: object;
};
}
import type { DialogFooterStylesType } from "@material-tailwind/react";
const theme = {
dialogFooter: {
styles: {
base: {
display: "flex",
alignItems: "items-center",
justifyContent: "justify-end",
},
},
},
};