Skip to content

ShowButton

Link button to the show page of the current record.

Use the button without form when in a ResourceContext (e.g., inside an <Edit>):

import { ShowButton, DeleteButton, Edit } from '@/components/admin';
const PostEdit = () => (
<Edit
actions={<>
<ShowButton />
<DleteButton />
</>}
>
...
</Edit>
);

Clicking on the button navigates to the show route of the current resource (e.g., /posts/123/show).

PropRequiredTypeDefaultDescription
iconOptionalReactNode<Eye />Icon to display
labelOptionalstringra.action.showi18n key / label
recordOptionalRaRecordFrom contextRecord used for id and representation
resourceOptionalstringFrom contextResource name

Additional props are passed to the underlying <a> element (e.g., className, target, rel).

By default, the label is the translation of the ra.action.show key, which reads “Show”.

You can customize the label for a specific resource by adding a resources.{resource}.action.show key to your translation messages. It receives %{name} (singular resource name) and %{recordRepresentation} (string representation of the current record):

const messages = {
resources: {
posts: {
action: {
show: 'View %{recordRepresentation}',
},
},
},
};

You can also pass a custom string or translation key directly via the label prop:

<ShowButton label="View details" />
<ShowButton label="resources.posts.action.show" />