Skip to content

Commit cfc30f0

Browse files
committed
feat(dialog): Add new overlayProps to configure the dialog's overlay
1 parent 10984f5 commit cfc30f0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/dialog/src/Dialog.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export interface BaseDialogProps
6767
* A function used to close the dialog when the overlay is clicked or the
6868
* escape key is pressed when the `modal` prop is not enabled.
6969
*/
70-
onRequestClose: () => void;
70+
onRequestClose(): void;
7171

7272
/**
7373
* The tab index for the sheet. This should normally stay at `-1`.
@@ -187,6 +187,13 @@ export interface BaseDialogProps
187187
* conditionally render a navigation panel.
188188
*/
189189
component?: "div" | "nav";
190+
191+
/**
192+
* Any additional props that should be passed to the `Overlay` element.
193+
*
194+
* @remarks \@since 5.0.0
195+
*/
196+
overlayProps?: Omit<HTMLAttributes<HTMLSpanElement>, "style" | "className">;
190197
}
191198

192199
export type DialogProps = LabelRequiredForA11y<BaseDialogProps>;
@@ -319,6 +326,7 @@ export const Dialog = forwardRef<HTMLDivElement, DialogProps>(function Dialog(
319326
disableFocusOnUnmount = false,
320327
disableNestedDialogFixes = false,
321328
onKeyDown,
329+
overlayProps,
322330
...props
323331
},
324332
nodeRef
@@ -345,6 +353,7 @@ export const Dialog = forwardRef<HTMLDivElement, DialogProps>(function Dialog(
345353
overlayEl = (
346354
<Overlay
347355
id={`${id}-overlay`}
356+
{...overlayProps}
348357
style={overlayStyle}
349358
className={cn("rmd-dialog-overlay", overlayClassName)}
350359
hidden={overlayHidden || disableOverlay}

0 commit comments

Comments
 (0)