I need to make a Clipboard component look different. Specifically I need to make it look like a Button that includes the text “Copy Data”.
I don’t see any properties for the Clipboard that enable me to change it this way. I’ve tried to use javascript’s appendChild() to inject HTML into the top-level div for the Clipboard but I ran into a timing problem. That is, when my code below runs the window is loaded but React has yet to embed thediv in the DOM and my_clipboard is null).
window.addEventListener('load', function(event) {
let my_clipboard = document.getElementById("my-clipboard");
let text = document.createTextNode("Copy Data");
my_clipboard.appendChild(text);
});
Might anyone be able to help me with my timing issue or suggest a different approach to change how the Clipboard component looks?
I agree, it should be easier to style Clipboard. I think I can do a PR to fix this.
In the meantime, a workaround is make a button and style it any way you like, then position the dcc.Clipboard on top of it and make it transparent so you don’t see the icon. Here is an example: