Skip to content

EditButton

Link button to the edit page of the current record.

Use it inside a RecordContext, for example in the actions of a <Show> view, or in the rows of a <DataTable>.

import { DataTable, EditButton } from '@/components/admin';
const PostList = () => (
<DataTable>
<DataTable.Col source="title" />
<DataTable.Col source="author" />
<DataTable.Col source="published_at" />
<DataTable.Col>
<EditButton />
</DataTable.Col>
</DataTable>
);

On click, the button navigates to the edit route of the current resource and record (e.g., /posts/123/edit).

::tip

In a <DataTable>, you can replace a column with an <EditButton> by using the rowClick prop to make the whole row clickable and navigate to the edit page:

<DataTable rowClick="edit">
<DataTable.Col source="title" />
<DataTable.Col source="author" />
<DataTable.Col source="published_at" />
</DataTable>

::/tip

PropRequiredTypeDefaultDescription
labelOptionalstringra.action.editi18n key / label
recordOptionalRaRecordFrom contextRecord used for id
resourceOptionalstringFrom contextResource name