Is it possible to add custom buttons with actions to the content-manager page? e.g. adding a export to csv button next to the filter button. I read through the docs a bit but they’re a bit unclear for me.
I did the same and it worked. But I have a problem as follows:
I used fetch API to get data from strapi but I only received 50 records out of my total of 900. I’m thinking of using Entity service to get data but it doesn’t seem to work in admin/extension/components? Anyone have any ideas for this problem? Thanks
in my code, there is src/admin/app.example.js, I renamed src/admin/app.js
after that it start works.
if there is no file inside src/admin, just create app.js and use this reference
const config = {
locales: [],
};
import { Button } from '@strapi/design-system'
import React from 'react';
const bootstrap = (app) => {
app.injectContentManagerComponent("listView", "actions", {
name: "CustomCreateButton",
Component: () => (
<Button
variant='secondary'>
Rebuild Website
</Button>
),
});
app.injectContentManagerComponent("listView", "actions", {
name: "CustomCreateButton",
Component: () => {
// Use useEffect to remove the original button
React.useEffect(() => {
const defaultButton = document.querySelector('[href$="/create"]'); // Find the default button
if (defaultButton) {
defaultButton.style.display = "none"; // Hide it
}
}, []); // Run this once when the component mounts
return (
<Button
variant="success"
onClick={() => {
// Custom action for creating a new entry
alert("Custom Create Entry Clicked!");
}}
>
Custom Create Entry
</Button>
);
},
});
app.injectContentManagerComponent("editView", "right-links", {
name: "TweetButton",
Component: () => (
<Button
variant='secondary'
>
Rebuild Website
</Button>
),
});
};
export default {
config,
bootstrap,
};