Skip to content

Commit

Permalink
Fix <CloneButton> missing doc update + document `<ListButton scroll…
Browse files Browse the repository at this point in the history
…ToTop>`
  • Loading branch information
erwanMarmelab committed Jan 22, 2025
1 parent eaa085d commit b19a98d
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions docs/Buttons.md
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ It also supports [all the other `<Button>` props](#button).

### `scrollToTop`

By default, react-admin scrolls the page to the top after redirecting to the create view. You can disable it as follows:
By default, `<CloneButton>` scrolls the page to the top after redirecting to the create view. You can disable it as follows:

```jsx
const CloneButtonWithoutScrollToTop = () => <CloneButton scrollToTop={false} />
Expand Down Expand Up @@ -1140,14 +1140,23 @@ export const PostShow = () => (

### Props

| Prop | Required | Type | Default | Description |
| ---------- | -------- | --------------- | ---------------- | -------------------------------------------- |
| `resource` | Optional | `string` | - | target resource, e.g. 'posts' |
| `label` | Optional | `string` | 'ra.action.list' | label or translation message to use |
| `icon` | Optional | `ReactElement` | - | iconElement, e.g. `<CommentIcon />` |
| Prop | Required | Type | Default | Description |
| ------------- | -------- | --------------- | ---------------- | ---------------------------------------------- |
| `resource` | Optional | `string` | - | target resource, e.g. 'posts' |
| `label` | Optional | `string` | 'ra.action.list' | label or translation message to use |
| `icon` | Optional | `ReactElement` | - | iconElement, e.g. `<CommentIcon />` |
| `scrollToTop` | Optional | `boolean` | `true` | Scroll to top after link |

It also supports [all the other `<Button>` props](#button).

### `scrollToTop`

By default, `<ListButton>` scrolls the page to the top after redirecting. You can disable it as follows:

```jsx
const ListButtonWithoutScrollToTop = () => <ListButton scrollToTop={false} />
```

### Access Control

If your `authProvider` implements [Access Control](./Permissions.md#access-control), `<ListButton>` will only render if the user has the "list" access to the related resource.
Expand Down

0 comments on commit b19a98d

Please sign in to comment.