You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`resource`| Optional |`string`| - | Resource to link to, e.g. 'posts' |
1010
1010
|`record`| Optional |`Object`| - | Record to link to, e.g. `{ id: 12, foo: 'bar' }`|
1011
-
|`label`| Optional |`string`|'ra.action.edit'| Label or translation message to use |
1011
+
|`label`| Optional |`string`|- | Label or translation message to use |
1012
1012
|`icon`| Optional |`ReactElement`| - | Icon element, e.g. `<CommentIcon />`|
1013
1013
|`scrollToTop`| Optional |`boolean`|`true`| Scroll to top after link |
1014
1014
@@ -1020,6 +1020,39 @@ It also supports [all the other `<Button>` props](#button).
1020
1020
1021
1021
**Tip:** To allow users to edit a record without leaving the current view, use the [`<EditInDialogButton>`](./EditInDialogButton.md) component.
1022
1022
1023
+
### `label`
1024
+
1025
+
By default, the label for the `<EditButton>` is the translation key `ra.action.edit` that translates to "Edit".
1026
+
1027
+
You can customize this label by providing a resource specific translation with the key `resources.RESOURCE.action.edit` (e.g. `resources.posts.action.edit`):
1028
+
1029
+
```js
1030
+
// in src/i18n/en.js
1031
+
importenglishMessagesfrom'ra-language-english';
1032
+
1033
+
exportconsten= {
1034
+
...englishMessages,
1035
+
resources: {
1036
+
posts: {
1037
+
name:'Post |||| Posts',
1038
+
action: {
1039
+
edit:'Modify %{recordRepresentation}'
1040
+
}
1041
+
},
1042
+
},
1043
+
...
1044
+
};
1045
+
```
1046
+
1047
+
You can also customize this label by specifying a custom `label` prop:
1048
+
1049
+
1050
+
```jsx
1051
+
exportconstPostEditButton= () => (
1052
+
<EditButton label="Modify"/>
1053
+
);
1054
+
```
1055
+
1023
1056
### `scrollToTop`
1024
1057
1025
1058
By default, `<EditButton>` scrolls the page to the top after redirecting. You can disable it as follows:
@@ -1329,7 +1362,7 @@ const CommentEdit = () => (
1329
1362
|`resource`| Optional |`string`| - | The target resource, e.g. 'posts' |
1330
1363
|`record`| Optional |`Object`| - | Record to link to, e.g. `{ id: 12, foo: 'bar' }`|
1331
1364
|`component`| Optional |`ReactElement`| - | Base path to resource, e.g. '/posts' |
1332
-
|`label`| Optional |`string`|'ra.action.show'| Label or translation message to use |
1365
+
|`label`| Optional |`string`|- | Label or translation message to use |
1333
1366
|`icon`| Optional |`ReactElement`| - | Icon element, e.g. `<CommentIcon />`|
1334
1367
|`scrollToTop`| Optional |`boolean`|`true`| Scroll to top after link |
1335
1368
@@ -1339,6 +1372,39 @@ It also supports [all the other `<Button>` props](#button).
1339
1372
1340
1373
**Tip**: If you want to link to the Show view manually, use the `/{resource}/{record.id}/show` location.
1341
1374
1375
+
### `label`
1376
+
1377
+
By default, the label for the `<ShowButton>` is the translation key `ra.action.show` that translates to "Show".
1378
+
1379
+
You can customize this label by providing a resource specific translation with the key `resources.RESOURCE.action.show` (e.g. `resources.posts.action.show`):
1380
+
1381
+
```js
1382
+
// in src/i18n/en.js
1383
+
importenglishMessagesfrom'ra-language-english';
1384
+
1385
+
exportconsten= {
1386
+
...englishMessages,
1387
+
resources: {
1388
+
posts: {
1389
+
name:'Post |||| Posts',
1390
+
action: {
1391
+
show:'Display %{recordRepresentation}'
1392
+
}
1393
+
},
1394
+
},
1395
+
...
1396
+
};
1397
+
```
1398
+
1399
+
You can also customize this label by specifying a custom `label` prop:
1400
+
1401
+
1402
+
```jsx
1403
+
exportconstPostShowButton= () => (
1404
+
<ShowButton label="Display"/>
1405
+
);
1406
+
```
1407
+
1342
1408
### `scrollToTop`
1343
1409
1344
1410
By default, `<ShowButton>` scrolls the page to the top after redirecting. You can disable it as follows:
0 commit comments