diff --git a/docs/pages/material-ui/api/popover.json b/docs/pages/material-ui/api/popover.json
index d362711be03930..b573288f1783b7 100644
--- a/docs/pages/material-ui/api/popover.json
+++ b/docs/pages/material-ui/api/popover.json
@@ -28,6 +28,19 @@
"onClose": { "type": { "name": "func" } },
"PaperProps": {
"type": { "name": "shape", "description": "{ component?: element type }" },
+ "default": "{}",
+ "deprecated": true,
+ "deprecationInfo": "Use slotProps.paper
instead."
+ },
+ "slotProps": {
+ "type": {
+ "name": "shape",
+ "description": "{ paper?: func
| object, root?: func
| object }"
+ },
+ "default": "{}"
+ },
+ "slots": {
+ "type": { "name": "shape", "description": "{ paper?: elementType, root?: elementType }" },
"default": "{}"
},
"sx": {
diff --git a/docs/translations/api-docs/popover/popover.json b/docs/translations/api-docs/popover/popover.json
index cf8736c17df4db..a2dfd5653313de 100644
--- a/docs/translations/api-docs/popover/popover.json
+++ b/docs/translations/api-docs/popover/popover.json
@@ -13,7 +13,9 @@
"marginThreshold": "Specifies how close to the edge of the window the popover can appear.",
"onClose": "Callback fired when the component requests to be closed. The reason
parameter can optionally be used to control the response to onClose
.",
"open": "If true
, the component is shown.",
- "PaperProps": "Props applied to the Paper
element.",
+ "PaperProps": "Props applied to the Paper
element.
This prop is an alias for slotProps.paper
and will be overriden by it if both are used.",
+ "slotProps": "The extra props for the slot components. You can override the existing props or add new ones.",
+ "slots": "The components used for each slot inside.",
"sx": "The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details.",
"transformOrigin": "This is the point on the popover which will attach to the anchor's origin.
Options: vertical: [top, center, bottom, x(px)]; horizontal: [left, center, right, x(px)].",
"TransitionComponent": "The component used for the transition. Follow this guide to learn more about the requirements for this component.",
diff --git a/packages/mui-material/src/Menu/Menu.d.ts b/packages/mui-material/src/Menu/Menu.d.ts
index c0f243b12353fc..16e78dd1cd12e3 100644
--- a/packages/mui-material/src/Menu/Menu.d.ts
+++ b/packages/mui-material/src/Menu/Menu.d.ts
@@ -1,6 +1,7 @@
import * as React from 'react';
import { SxProps } from '@mui/system';
import { InternalStandardProps as StandardProps } from '..';
+import { PaperProps } from '../Paper';
import { PopoverProps } from '../Popover';
import { MenuListProps } from '../MenuList';
import { Theme } from '../styles';
@@ -79,6 +80,8 @@ export interface MenuProps extends StandardProps {
variant?: 'menu' | 'selectedMenu';
}
+export declare const MenuPaper: React.FC;
+
/**
*
* Demos:
diff --git a/packages/mui-material/src/Menu/Menu.js b/packages/mui-material/src/Menu/Menu.js
index 3a47c89c13c092..6a507c09edf243 100644
--- a/packages/mui-material/src/Menu/Menu.js
+++ b/packages/mui-material/src/Menu/Menu.js
@@ -5,8 +5,7 @@ import clsx from 'clsx';
import { unstable_composeClasses as composeClasses } from '@mui/base';
import { HTMLElementType } from '@mui/utils';
import MenuList from '../MenuList';
-import Paper from '../Paper';
-import Popover from '../Popover';
+import Popover, { PopoverPaper } from '../Popover';
import styled, { rootShouldForwardProp } from '../styles/styled';
import useTheme from '../styles/useTheme';
import useThemeProps from '../styles/useThemeProps';
@@ -41,7 +40,7 @@ const MenuRoot = styled(Popover, {
overridesResolver: (props, styles) => styles.root,
})({});
-const MenuPaper = styled(Paper, {
+export const MenuPaper = styled(PopoverPaper, {
name: 'MuiMenu',
slot: 'Paper',
overridesResolver: (props, styles) => styles.paper,
@@ -164,12 +163,14 @@ const Menu = React.forwardRef(function Menu(inProps, ref) {
horizontal: isRtl ? 'right' : 'left',
}}
transformOrigin={isRtl ? RTL_ORIGIN : LTR_ORIGIN}
- PaperProps={{
- as: MenuPaper,
- ...PaperProps,
- classes: {
- ...PaperProps.classes,
- root: classes.paper,
+ slots={{ paper: MenuPaper }}
+ slotProps={{
+ paper: {
+ ...PaperProps,
+ classes: {
+ ...PaperProps.classes,
+ root: classes.paper,
+ },
},
}}
className={classes.root}
diff --git a/packages/mui-material/src/Menu/Menu.test.js b/packages/mui-material/src/Menu/Menu.test.js
index d4a98a3632fc36..cfbe417e82873f 100644
--- a/packages/mui-material/src/Menu/Menu.test.js
+++ b/packages/mui-material/src/Menu/Menu.test.js
@@ -3,6 +3,7 @@ import { spy } from 'sinon';
import { expect } from 'chai';
import {
createRenderer,
+ createMount,
describeConformance,
screen,
fireEvent,
@@ -11,9 +12,11 @@ import {
import Menu, { menuClasses as classes } from '@mui/material/Menu';
import Popover from '@mui/material/Popover';
import { createTheme, ThemeProvider } from '@mui/material/styles';
+import { MenuPaper } from './Menu';
describe('', () => {
const { render } = createRenderer({ clock: 'fake' });
+ const mount = createMount();
describeConformance(