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`| - | Target resource, e.g. 'posts' |
697
-
|`label`| Optional |`string`|'ra.action.create'| label or translation message to use |
766
+
|`label`| Optional |`string`|- | label or translation message to use |
698
767
|`icon`| Optional |`ReactElement`| - | iconElement, e.g. `<CommentIcon />`|
699
768
|`scrollToTop`| Optional |`boolean`|`true`| Scroll to top after link |
700
769
@@ -704,6 +773,44 @@ It also supports [all the other `<Button>` props](#button).
704
773
705
774
**Tip:** To allow users to create a record without leaving the current view, use the [`<CreateInDialogButton>`](./CreateInDialogButton.md) component.
706
775
776
+
### `label`
777
+
778
+
By default, the label for the `<CreateButton>` is the translation key `ra.action.create` that translates to "Create".
779
+
780
+
You can customize this label by providing a resource specific translation with the key `resources.RESOURCE.action.create` (e.g. `resources.posts.action.create`):
781
+
782
+
```js
783
+
// in src/i18n/en.js
784
+
importenglishMessagesfrom'ra-language-english';
785
+
786
+
exportconsten= {
787
+
...englishMessages,
788
+
resources: {
789
+
posts: {
790
+
name:'Post |||| Posts',
791
+
action: {
792
+
create:'New post'
793
+
}
794
+
},
795
+
},
796
+
...
797
+
};
798
+
```
799
+
800
+
You can also customize this label by specifying a custom `label` prop:
801
+
802
+
```jsx
803
+
exportconstPostCreateButton= () => (
804
+
<CreateButton label="New post"/>
805
+
);
806
+
```
807
+
808
+
Custom labels are automatically translated, so you can use a translation key, too:
@@ -780,7 +887,27 @@ You can also call it with a record and a resource:
780
887
781
888
By default, the label is `Delete` in English. In other languages, it's the translation of the `'ra.action.delete'` key.
782
889
783
-
To customize the `<DeleteButton>` label, you can either change the translation in your i18nProvider, or pass a `label` prop:
890
+
You can customize this label by providing a resource specific translation with the key `resources.RESOURCE.action.delete` (e.g. `resources.posts.action.delete`):
|`resource`| Optional |`string`| - | Resource to link to, e.g. 'posts' |
977
1104
|`record`| Optional |`Object`| - | Record to link to, e.g. `{ id: 12, foo: 'bar' }`|
978
-
|`label`| Optional |`string`|'ra.action.edit'| Label or translation message to use |
1105
+
|`label`| Optional |`string`|- | Label or translation message to use |
979
1106
|`icon`| Optional |`ReactElement`| - | Icon element, e.g. `<CommentIcon />`|
980
1107
|`scrollToTop`| Optional |`boolean`|`true`| Scroll to top after link |
981
1108
@@ -987,6 +1114,45 @@ It also supports [all the other `<Button>` props](#button).
987
1114
988
1115
**Tip:** To allow users to edit a record without leaving the current view, use the [`<EditInDialogButton>`](./EditInDialogButton.md) component.
989
1116
1117
+
### `label`
1118
+
1119
+
By default, the label for the `<EditButton>` is the translation key `ra.action.edit` that translates to "Edit".
1120
+
1121
+
You can customize this label by providing a resource specific translation with the key `resources.RESOURCE.action.edit` (e.g. `resources.posts.action.edit`):
1122
+
1123
+
```js
1124
+
// in src/i18n/en.js
1125
+
importenglishMessagesfrom'ra-language-english';
1126
+
1127
+
exportconsten= {
1128
+
...englishMessages,
1129
+
resources: {
1130
+
posts: {
1131
+
name:'Post |||| Posts',
1132
+
action: {
1133
+
edit:'Modify %{recordRepresentation}'
1134
+
}
1135
+
},
1136
+
},
1137
+
...
1138
+
};
1139
+
```
1140
+
1141
+
You can also customize this label by specifying a custom `label` prop:
1142
+
1143
+
1144
+
```jsx
1145
+
exportconstPostEditButton= () => (
1146
+
<EditButton label="Modify"/>
1147
+
);
1148
+
```
1149
+
1150
+
Custom labels are automatically translated, so you can use a translation key, too:
|`resource`| Optional |`string`| - | target resource, e.g. 'posts' |
1155
-
|`label`| Optional |`string`|'ra.action.list'| label or translation message to use |
1321
+
|`label`| Optional |`string`|- | label or translation message to use |
1156
1322
|`icon`| Optional |`ReactElement`| - | iconElement, e.g. `<CommentIcon />`|
1157
1323
|`scrollToTop`| Optional |`boolean`|`true`| Scroll to top after link |
1158
1324
1159
1325
It also supports [all the other `<Button>` props](#button).
1160
1326
1327
+
### `label`
1328
+
1329
+
By default, the label is `List` in English. In other languages, it's the translation of the `'ra.action.list'` key.
1330
+
1331
+
You can customize this label by providing a resource specific translation with the key `resources.RESOURCE.action.list` (e.g. `resources.posts.action.list`):
1332
+
1333
+
```js
1334
+
// in src/i18n/en.js
1335
+
importenglishMessagesfrom'ra-language-english';
1336
+
1337
+
exportconsten= {
1338
+
...englishMessages,
1339
+
resources: {
1340
+
posts: {
1341
+
name:'Post |||| Posts',
1342
+
action: {
1343
+
list:'See all posts'
1344
+
}
1345
+
},
1346
+
},
1347
+
...
1348
+
};
1349
+
```
1350
+
1351
+
You can also customize this label by specifying a custom `label` prop:
1352
+
1353
+
```jsx
1354
+
<ListButton label="See all comments"/>
1355
+
```
1356
+
1357
+
Custom labels are automatically translated, so you can use a translation key, too:
By default, `<ListButton>` scrolls the page to the top after redirecting. You can disable it as follows:
@@ -1296,7 +1498,7 @@ const CommentEdit = () => (
1296
1498
|`resource`| Optional |`string`| - | The target resource, e.g. 'posts' |
1297
1499
|`record`| Optional |`Object`| - | Record to link to, e.g. `{ id: 12, foo: 'bar' }`|
1298
1500
|`component`| Optional |`ReactElement`| - | Base path to resource, e.g. '/posts' |
1299
-
|`label`| Optional |`string`|'ra.action.show'| Label or translation message to use |
1501
+
|`label`| Optional |`string`|- | Label or translation message to use |
1300
1502
|`icon`| Optional |`ReactElement`| - | Icon element, e.g. `<CommentIcon />`|
1301
1503
|`scrollToTop`| Optional |`boolean`|`true`| Scroll to top after link |
1302
1504
@@ -1306,6 +1508,44 @@ It also supports [all the other `<Button>` props](#button).
1306
1508
1307
1509
**Tip**: If you want to link to the Show view manually, use the `/{resource}/{record.id}/show` location.
1308
1510
1511
+
### `label`
1512
+
1513
+
By default, the label for the `<ShowButton>` is the translation key `ra.action.show` that translates to "Show".
1514
+
1515
+
You can customize this label by providing a resource specific translation with the key `resources.RESOURCE.action.show` (e.g. `resources.posts.action.show`):
1516
+
1517
+
```js
1518
+
// in src/i18n/en.js
1519
+
importenglishMessagesfrom'ra-language-english';
1520
+
1521
+
exportconsten= {
1522
+
...englishMessages,
1523
+
resources: {
1524
+
posts: {
1525
+
name:'Post |||| Posts',
1526
+
action: {
1527
+
show:'Display %{recordRepresentation}'
1528
+
}
1529
+
},
1530
+
},
1531
+
...
1532
+
};
1533
+
```
1534
+
1535
+
You can also customize this label by specifying a custom `label` prop:
1536
+
1537
+
```jsx
1538
+
exportconstPostShowButton= () => (
1539
+
<ShowButton label="Display"/>
1540
+
);
1541
+
```
1542
+
1543
+
Custom labels are automatically translated, so you can use a translation key, too:
Copy file name to clipboardExpand all lines: docs/Create.md
+22-2Lines changed: 22 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -342,9 +342,29 @@ To override the style of all instances of `<Create>` components using the [appli
342
342
343
343
## `title`
344
344
345
-
By default, the title for the `Create` view is "Create [resource_name]".
345
+
By default, the title for the `Create` view is the translation key `ra.page.create` that translates to "Create [resource_name]" as we also pass the translation of the [resource name](./TranslationTranslating.md#translating-resource-and-field-names) in its singular form.
346
346
347
-
You can customize this title by specifying a custom `title` prop:
347
+
You can customize this title by providing a resource specific translation with the key `resources.RESOURCE.page.create` (e.g. `resources.posts.page.create`):
348
+
349
+
```js
350
+
// in src/i18n/en.js
351
+
importenglishMessagesfrom'ra-language-english';
352
+
353
+
exportconsten= {
354
+
...englishMessages,
355
+
resources: {
356
+
posts: {
357
+
name:'Post |||| Posts',
358
+
page: {
359
+
create:'New post'
360
+
}
361
+
},
362
+
},
363
+
...
364
+
};
365
+
```
366
+
367
+
You can also customize this title by specifying a custom `title` prop:
Copy file name to clipboardExpand all lines: docs/Edit.md
+22-2Lines changed: 22 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -571,9 +571,29 @@ To override the style of all instances of `<Edit>` components using the [applica
571
571
572
572
## `title`
573
573
574
-
By default, the title for the Edit view is “Edit [resource_name][record representation]”. Check the [`<Resource recordRepresentation>`](./Resource.md#recordrepresentation) prop for more details.
574
+
By default, the title for the Edit view is the translation key `ra.page.edit` that translates to “Edit [resource_name][record representation]”. Check the [`<Resource recordRepresentation>`](./Resource.md#recordrepresentation) prop for more details.
575
575
576
-
You can customize this title by specifying a custom `title` string:
576
+
You can customize this title by providing a resource specific translation with the key `resources.RESOURCE.page.edit` (e.g. `resources.posts.page.edit`):
577
+
578
+
```js
579
+
// in src/i18n/en.js
580
+
importenglishMessagesfrom'ra-language-english';
581
+
582
+
exportconsten= {
583
+
...englishMessages,
584
+
resources: {
585
+
posts: {
586
+
name:'Post |||| Posts',
587
+
page: {
588
+
edit:'Update post "%{recordRepresentation}"'
589
+
}
590
+
},
591
+
},
592
+
...
593
+
};
594
+
```
595
+
596
+
You can also customize this title by specifying a custom `title` string:
0 commit comments