From 7d2e4c2f8d2772fe0e20f2cd53760c2592bb6b5e Mon Sep 17 00:00:00 2001 From: fzaninotto Date: Tue, 12 Mar 2024 15:46:54 +0100 Subject: [PATCH] [Doc] Fix upgrade guide suggest using defaultProps override in theme for react-admin components Closes #9706 --- docs/Upgrade.md | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/docs/Upgrade.md b/docs/Upgrade.md index 73c9fcbbbcf..0a0b39c2f41 100644 --- a/docs/Upgrade.md +++ b/docs/Upgrade.md @@ -1716,7 +1716,9 @@ const MyForm = () => ( ### `` and `` No Longer Accept `margin` and `variant` -Just like Material UI, we don't provide a way to specify those props at the form level. Instead, you can either set those props on the inputs or leverage the Material UI [component overrides through theme](https://mui.com/material-ui/customization/theme-components/) if you need to change them globally: +Just like Material UI, we don't provide a way to specify those props at the form level. + +Instead, you can set those props on the inputs: ```diff const PostCreate = () => ( @@ -1730,9 +1732,8 @@ const PostCreate = () => ( ) ``` -You have several options when leveraging the [theme component overrides](https://mui.com/material-ui/customization/theme-components/): +Alternatively, you can leverage the Material UI [component overrides through theme](https://mui.com/material-ui/customization/theme-components/) if you need to change them globally. This works for MUI components such as the `TextField`: -- Provide your own default props for Material UI components such as the `TextField`: ```js const myTheme = { components: { @@ -1747,20 +1748,7 @@ const myTheme = { } ``` -- Provide your own default props for react-admin components such as the `TextInput`: -```js -const myTheme = { - components: { - // Name of the component - RaTextInput: { - defaultProps: { - margin: 'normal', - variant: 'outlined', - }, - }, - }, -} -``` +Note that react-admin components (like `) don't support these default props overrides. ### No More Props Injection In ``, `` and ``