diff --git a/docs/public/static/error-codes.json b/docs/public/static/error-codes.json index 035e08d0d408cb..6ed79ecb07fc1f 100644 --- a/docs/public/static/error-codes.json +++ b/docs/public/static/error-codes.json @@ -20,5 +20,8 @@ "19": "MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.For more details, see https://github.com/mui/material-ui/pull/35150.", "20": "MUI: `vars` is a private field used for CSS variables support.\nPlease use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.", "21": "MUI: The `colorSchemes.%s` option is either missing or invalid.", - "22": "MUI: `vars` is a private field used for CSS variables support.\nPlease use another name or follow the [docs](https://next.mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature." + "22": "MUI: `vars` is a private field used for CSS variables support.\nPlease use another name or follow the [docs](https://next.mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.", + "23": "MUI: No TabContext provided. TabList must be used within a TabContext. Wrap your Tabs with . See https://mui.com/material-ui/react-tabs/#experimental-api for more info.", + "24": "MUI: No TabContext provided. TabPanel must be used within a TabContext. Wrap your TabPanel with . See https://mui.com/material-ui/react-tabs/#experimental-api for more info.", + "25": "MUI: The `colorSchemes.%s` option is either missing or invalid. Ensure the default color scheme is defined in colorSchemes with a valid palette configuration." } diff --git a/packages/mui-lab/src/TabList/TabList.tsx b/packages/mui-lab/src/TabList/TabList.tsx index 99d55602481165..77ffa16c5ff388 100644 --- a/packages/mui-lab/src/TabList/TabList.tsx +++ b/packages/mui-lab/src/TabList/TabList.tsx @@ -39,7 +39,12 @@ const TabList = React.forwardRef(function TabList( const { children: childrenProp, ...other } = props; const context = useTabContext(); if (context === null) { - throw new TypeError('No TabContext provided'); + throw /* minify-error */ new TypeError( + 'MUI: No TabContext provided. ' + + 'TabList must be used within a TabContext. ' + + 'Wrap your Tabs with . ' + + 'See https://mui.com/material-ui/react-tabs/#experimental-api for more info.', + ); } const children = React.Children.map(childrenProp, (child) => { if (!React.isValidElement<{ value?: string | number | undefined }>(child)) { diff --git a/packages/mui-lab/src/TabPanel/TabPanel.tsx b/packages/mui-lab/src/TabPanel/TabPanel.tsx index 0737da9ad3ceb1..aa9ff08f118d8b 100644 --- a/packages/mui-lab/src/TabPanel/TabPanel.tsx +++ b/packages/mui-lab/src/TabPanel/TabPanel.tsx @@ -79,7 +79,12 @@ const TabPanel = React.forwardRef(function TabPanel( const context = useTabContext(); if (context === null) { - throw new TypeError('No TabContext provided'); + throw /* minify-error */ new TypeError( + 'MUI: No TabContext provided. ' + + 'TabPanel must be used within a TabContext. ' + + 'Wrap your TabPanel with . ' + + 'See https://mui.com/material-ui/react-tabs/#experimental-api for more info.', + ); } const id = getPanelId(context, value as string); const tabId = getTabId(context, value as string); diff --git a/packages/mui-material/src/styles/createThemeWithVars.js b/packages/mui-material/src/styles/createThemeWithVars.js index bd00b44d4c4ba7..21d39b67cc806a 100644 --- a/packages/mui-material/src/styles/createThemeWithVars.js +++ b/packages/mui-material/src/styles/createThemeWithVars.js @@ -173,7 +173,8 @@ export default function createThemeWithVars(options = {}, ...args) { if (!defaultScheme) { throw /* minify-error */ new Error( - `MUI: The \`colorSchemes.${defaultColorScheme}\` option is either missing or invalid.`, + `MUI: The \`colorSchemes.${defaultColorScheme}\` option is either missing or invalid. ` + + 'Ensure the default color scheme is defined in colorSchemes with a valid palette configuration.', ); }