Skip to content

Commit

Permalink
Merge pull request #9915 from marmelab/doc-SaveButton-transform
Browse files Browse the repository at this point in the history
[Doc] Clarify `<SaveButton transform>` usage
  • Loading branch information
fzaninotto authored Jun 11, 2024
2 parents c2c7dbf + fb383c8 commit a91a5be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/SaveButton.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,13 @@ const transformUser = data => ({

const UserCreateToolbar = () => (
<Toolbar>
<SaveButton transform={transformUser} />
<SaveButton type="button" transform={transformUser} />
</Toolbar>
);
```

**Tip:** You need to set `type="button"` on the `<SaveButton>` to use `transform`. Without it, the form would be submitted with the default `transform` from the main page.

## `type`

By default, `<SaveButton>` renders a `submit` button. You can change this by passing `type="button"`. It is especially useful when using more than one save button in a form:
Expand Down

0 comments on commit a91a5be

Please sign in to comment.