Use our AstroLaunch UI Dialog
component to inform users about a task or important information that require decisions, or involves multiple tasks.
A dialog is a type of modal window with critical information which disable all app functionality when they appear and remains on screen until confirmed/dismissed.
See below our dialog example that you can use for your AstroLaunch UI and React project.
Preview
Code
The Dialog
component comes with 6 different sizes that you can change it using the size
prop.
Preview
Code
You can modify the open/close state animation for Dialog
component using the animate
prop.
Preview
Code
Use the example below to create a dialog with a sign in form.
Preview
Code
Use the example below to create a dialog with an image inside, similar to unsplash.
Preview
Code
Use the example below to create a Web 3.0 wallet connect dialog.
Preview
Code
Preview
Code
Preview
Code
Preview
Code
The following props are available for dialog component. These are the custom props that we've added for the dialog component and you can use all the other native props as well.
Attribute | Type | Description | Default |
---|---|---|---|
open | boolean | Open the dialog | No default value it's a required prop. |
handler | function | Controls open and close states for dialog | No default value it's a required prop. |
size | Size | Change dialog size | md |
dismiss | Dismiss | Change backdrop dismiss listeners | undefined |
animate | Animate | Change dialog animation | undefined |
className | string | Add custom className for dialog | '' |
children | node | Add content for dialog | No default value it's a required prop. |
import type { DialogProps } from "@material-tailwind/react";
The following props are available for dialog header component. These are the custom props that we've added for the dialog header component and you can use all the other native props as well.
Attribute | Type | Description | Default |
---|---|---|---|
className | string | Add custom className for dialog header | '' |
children | node | Add content for dialog header | No default value it's a required prop. |
import type { DialogHeaderProps } from "@material-tailwind/react";
The following props are available for dialog body component. These are the custom props that we've added for the dialog body component and you can use all the other native props as well.
Attribute | Type | Description | Default |
---|---|---|---|
divider | boolean | Add border top & bottom for dialog body | false |
className | string | Add custom className for dialog body | '' |
children | node | Add content for dialog body | No default value it's a required prop. |
import type { DialogBodyProps } from "@material-tailwind/react";
The following props are available for dialog footer component. These are the custom props that we've added for the dialog footer component and you can use all the other native props as well.
Attribute | Type | Description | Default |
---|---|---|---|
className | string | Add custom className for dialog footer | '' |
children | node | Add content for dialog footer | No default value it's a required prop. |
import type { DialogFooterProps } from "@material-tailwind/react";
type size = "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
type dismissType = {
enabled?: boolean;
escapeKey?: boolean;
referencePress?: boolean;
referencePressEvent?: 'pointerdown' | 'mousedown' | 'click';
outsidePress?: boolean | ((event: MouseEvent) => boolean);
outsidePressEvent?: 'pointerdown' | 'mousedown' | 'click';
ancestorScroll?: boolean;
bubbles?: boolean | {
escapeKey?: boolean;
outsidePress?: boolean;
};
};
type animate = {
mount?: object;
unmount?: object;
};
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;
referencePress: boolean;
referencePressEvent: 'pointerdown' | 'mousedown' | 'click';
outsidePress: boolean | ((event: MouseEvent) => boolean);
outsidePressEvent: 'pointerdown' | 'mousedown' | 'click';
ancestorScroll: boolean;
bubbles: boolean | {
escapeKey: boolean;
outsidePress: 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: {
defaultProps: {
size: "md",
dismiss: {},
animate: {
unmount: {},
mount: {},
},
className: "",
},
valid: {
sizes: ["xs", "sm", "md", "lg", "xl", "xxl"],
},
styles: {
base: {
backdrop: {
display: "grid",
placeItems: "place-items-center",
position: "fixed",
top: 0,
left: 0,
width: "w-screen",
height: "h-screen",
backgroundColor: "bg-black",
backgroundOpacity: "bg-opacity-60",
backdropFilter: "backdrop-blur-sm",
},
container: {
position: "relative",
bg: "bg-white",
m: "m-4",
borderRadius: "rounded-lg",
boxShadow: "shadow-2xl",
color: "text-blue-gray-500",
fontSmoothing: "antialiased",
fontFamily: "font-sans",
fontSize: "text-base",
fontWeight: "font-light",
lineHeight: "leading-relaxed",
},
},
sizes: {
xs: {
width: "w-full md:w-3/5 lg:w-2/5 2xl:w-1/4",
minWidth: "min-w-[80%] md:min-w-[60%] lg:min-w-[40%] 2xl:min-w-[25%]",
maxWidth: "max-w-[80%] md:max-w-[60%] lg:max-w-[40%] 2xl:max-w-[25%]",
},
sm: {
width: "w-full md:w-2/3 lg:w-2/4 2xl:w-1/3",
minWidth: "min-w-[80%] md:min-w-[66.666667%] lg:min-w-[50%] 2xl:min-w-[33.333333%]",
maxWidth: "max-w-[80%] md:max-w-[66.666667%] lg:max-w-[50%] 2xl:max-w-[33.333333%]",
},
md: {
width: "w-full md:w-3/4 lg:w-3/5 2xl:w-2/5",
minWidth: "min-w-[90%] md:min-w-[75%] lg:min-w-[60%] 2xl:min-w-[40%]",
maxWidth: "max-w-[90%] md:max-w-[75%] lg:max-w-[60%] 2xl:max-w-[40%]",
},
lg: {
width: "w-full md:w-5/6 lg:w-3/4 2xl:w-3/5",
minWidth: "min-w-[90%] md:min-w-[83.333333%] lg:min-w-[75%] 2xl:min-w-[60%]",
maxWidth: "max-w-[90%] md:max-w-[83.333333%] lg:max-w-[75%] 2xl:max-w-[60%]",
},
xl: {
width: "w-full md:w-5/6 2xl:w-3/4",
minWidth: "min-w-[95%] md:min-w-[83.333333%] 2xl:min-w-[75%]",
maxWidth: "max-w-[95%] md:max-w-[83.333333%] 2xl:max-w-[75%]",
},
xxl: {
display: "flex",
flexDirection: "flex-col",
width: "w-screen",
minWidth: "min-w-[100vw]",
maxWidth: "max-w-[100vw]",
height: "h-screen",
minHeight: "min-h-[100vh]",
maxHeight: "max-h-[100vh]",
m: "m-0",
borderRadius: "rounded-none",
},
},
},
},
};
interface DialogHeaderStylesType {
defaultProps: {
className: string;
};
styles: {
base: object;
};
}
import type { DialogHeaderStylesType } from "@material-tailwind/react";
const theme = {
dialogHeader: {
defaultProps: {
className: "",
},
styles: {
base: {
display: "flex",
alignItems: "items-center",
flexShrink: "shrink-0",
p: "p-4",
color: "text-blue-gray-900",
fontSmoothing: "antialiased",
fontFamily: "font-sans",
fontSize: "text-2xl",
fontWeight: "font-semibold",
lineHeight: "leading-snug",
},
},
},
};
interface DialogBodyStylesType {
defaultProps: {
className: string;
divider: boolean;
};
styles: {
base: {
initial: object;
divider: object;
};
};
}
import type { DialogBodyStylesType } from "@material-tailwind/react";
const theme = {
dialogBody: {
defaultProps: {
className: "",
divider: false,
},
styles: {
base: {
initial: {
position: "relative",
p: "p-4",
color: "text-blue-gray-500",
fontSmoothing: "antialiased",
fontFamily: "font-sans",
fontSize: "text-base",
fontWeight: "font-light",
lineHeight: "leading-relaxed",
},
divider: {
borderTop: "border-t",
borderTopColor: "border-t-blue-gray-100",
borderBottom: "border-b",
borderBottomColor: "border-b-blue-gray-100",
},
},
},
},
};
interface DialogFooterStylesType {
defaultProps: {
className: string;
};
styles: {
base: object;
};
}
import type { DialogFooterStylesType } from "@material-tailwind/react";
const theme = {
dialogFooter: {
defaultProps: {
className: "",
},
styles: {
base: {
display: "flex",
alignItems: "items-center",
justifyContent: "justify-end",
flexShrink: "shrink-0",
flexWrap: "flex-wrap",
p: "p-4",
color: "text-blue-gray-500",
},
},
},
};
If you want to see more examples and properties please check the official Material Tailwind Documentation.