Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Fix upgrade guide suggest using defaultProps override in theme for react-admin components #9713

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions docs/Upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,9 @@ const MyForm = () => (

### `<SimpleForm>` and `<TabbedForm>` 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 = () => (
Expand All @@ -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: {
Expand All @@ -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 `<TextInput`>) don't support these default props overrides.

### No More Props Injection In `<SimpleForm>`, `<TabbedForm>` and `<FilterForm>`

Expand Down
Loading