Hi everyone, In my grid, I added "Copy All" material UI icons. My grid has 2 columns and 2 rows. I need to copy all column and rows value with copy all icon is clicked.
Code:
const list=[{
id:1,
name:'aaa'
},
{id:2,
name:'bbb'},
{id:3,
name:'ccb'},
{id:4,
name:'babb'},
]
<div>
<CopyAllIcon/>
<Grid container rowSpacing={2}>
{list.map((item)=>{
<Grid xs={6}>
{item.name})}}
</Grid>
</Grid>
</div>
I don't know how to copy the all value in the clipboard.
My expected result is: Which clicks the copyAll icon, In my clipboard write as aaa, bbb, ccb, babb.
CopyAllIconlike all MaterialIcon icons is nothing but a dumb SVG-based image/icon. It's not some smart component that actually does any copying or writing to the clipboard.In order to implement actual writing to the clipboard, you'd have to write your own function using the [Web API][1] and call that function from a button's
onClickmethod. That button may wrap the icon.